in reply to Re: Here, doccy doccy. nice doccy. heredoc, treat.
in thread Here, doccy doccy. nice doccy. heredoc, treat.
actually, a nitpick -- you need your heredoc to be:
note 'HERE' rather than HERE. qw does not interpolate.
my @list = split(' ', <<'HERE');
and possibly $a
varaiable or $2
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
(currently, that gives this warning:
print <<(HEREDOC, qx);
so we'd not be breaking good existing uses of heredocs.)
Use of bare << to mean <<"" is deprecated at everywhere.pl line 23.