Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Re: Here, doccy doccy. nice doccy. heredoc, treat.

by Vynce (Friar)
on Jun 22, 2001 at 01:47 UTC ( [id://90556]=note: print w/replies, xml ) Need Help??


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:

my @list = split(' ', <<'HERE'); some whitespace separated words and possibly $a varaiable or $2 HERE
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); date df HEREDOC
(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.)

.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://90556]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-19 01:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found