actually, a nitpick -- you need your heredoc to be:
my @list = split(' ', <<'HERE');
and possibly $a
varaiable or $2
note 'HERE' rather than HERE. qw does not interpolate.
otherise, yes, that solution does work -- for qw(). and i'm sure a similar solution could be made to work for qr//. and of course q(), qq() and qx() are all trivial (though the special case qx'' is not so trivial, as far as i can tell). but perl6 introduces new quoting mechanisms (including, i think, customizable quoting mechanisms), and i might like to be able to use heredocs with those.
although, i guess i do take your point -- the quotes around the HEREDOC delimiter are not actually being used as those quotes in that case. so maybe heredoc could have an optional second argument (don't ask me how, i'm jsut thinking out loud here) that says what quoting mechanism to use. (ok, nevermind, i'll suggest how after all) like
print <<(HEREDOC, qx);
(currently, that gives this warning:
Use of bare << to mean <<"" is deprecated at everywhere.pl line 23.
so we'd not be breaking good existing uses of heredocs.)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
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.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||