Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

FWIW, heredocs aren't ugly :) if text is more than one line, heredocs are my first choice, of the form

my $html = <<'__HTML__'; __HTML__ my $xml = <<'__XML__'; __XML__ my $foo = <<'__EOF__'; __EOF__

I've often pasted multiline text and had to adjust the delimiters, ditching '' and "" and {} for q~~. With heredocs this is very rare. I've had HERE or EOF show up a few times, but virtually never __EOF__, which I also like for its similarity to __DATA__ and __END__

Its part of my template, I even have a hotkey in my editor for heredocs

I also prefer  qw' l i s t ' or  qw/ l i s t/ because no shift key is involved, and its all pinky action (on QWERTY keyboard),  use CGI 3.55 qw/ param /;  use Data::Dump qw' dd ';

for oneliner portability, i prefer qq// and q//, much easier to move between shells , only have to change leading/trailing "" into '' and vice versa

For match/substitution, i prefer  s/// and then to avoid leaning toothpick syndrome i switch to one of  s;;;  s=== depending on the regex, similarly because shift isn't required, and its all pinky action :)

for larger regex I always use balanced  s{}{}ex; or

s{ }{ }ex;

though the options are ridiculous :D

perl -MO=Deparse -e " s///g " perl -MO=Deparse -e " s\\\g " perl -MO=Deparse -e " s[][]g " perl -MO=Deparse -e " s()()g " perl -MO=Deparse -e " s{}{}g " perl -MO=Deparse -e " s!!!g " perl -MO=Deparse -e " s###g " perl -MO=Deparse -e " s vvvg " perl -MO=Deparse -e " s ___g " perl -MO=Deparse -e " s {}//g " perl -MO=Deparse -e " s {}\\g " perl -MO=Deparse -e " s {}vvg " perl -MO=Deparse -e " s {}()g " perl -MO=Deparse -e " s {}[]g " perl -MO=Deparse -e " s {}<>g " perl -MO=Deparse -e " s<><>g "

you're correct, you definitely want to avoid alphanumeric for delimiters, esp fancy unicode


In reply to Re: Quote and Quote-like Operators by Anonymous Monk
in thread Quote and Quote-like Operators by Xiong

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2024-04-23 10:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found