The use of here documents is particularly useful ... because it allows you to keep the markup relatively free of escape characters that would otherwise reduce ... readability
(opinionated note on coding style, your preference may vary)
The HERE doc syntax was once a favorite here, but now it
has been completely abandoned because:
- 1) There were cases of too many 'escape' chars strewn about,
(as mentioned elsewhere in this thread) which motivated a 'zero-tolerance' bias to *absolutely ban all ugly escape sequences*.
- 2) There were cases where *some* of the variables were intended to be
interpolated, but not others (e.g., with code-generation
scripts) so it was not clear whether to use "EOT" or 'EOT'
(as mentioned elsewhere in this thread).
- 3) Indentation hassles (as mentioned elsewhere in this thread).
Because of these issues, we made a stylistic decision not to use
HERE doc syntax anymore, and instead use the very flexible quotelike
operator with all variables 'concatenated in' instead.
Thus, your example would become:
my $foo = 123.45;
my $bar = "Martha Stewedprune";
This is an example of
text taken literally
except that variables are
expanded where their
variable names appear.
(Our *uninterpolated* variable
names are "$foo" and "$bar"
and we didn't need escape
chars to tell you that).
All you have to worry about is to make sure your quotelike delim character (caret) is never used in the document. If it is, just change it to something else. Moreover, you can indent this however you want
without external module dependencies. Here, we just use
comments to make the document visually distinct from the rest of
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||