Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by chipmunk (Parson)
on Jun 21, 2001 at 19:24 UTC ( #90409=note: print w/replies, xml ) Need Help??


in reply to Here, doccy doccy. nice doccy. heredoc, treat.

Next you'll be wanting to quote the q() delimiters with qq(): q qq(DELIMITER)Here is my happy string!qq(DELIMITER);
Sorry, you just can't do that.

On the other hand, you could get the effect of qw() with a heredoc like this:

my @list = split(' ', <<HERE); some whitespace separated words HERE

Replies are listed 'Best First'.
Re: Re: Here, doccy doccy. nice doccy. heredoc, treat.
by Vynce (Friar) on Jun 22, 2001 at 01:47 UTC

    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
Node Status?
node history
Node Type: note [id://90409]
help
Chatterbox?
[Discipulus]: my warmest comprehension karlgoethebier ;=(
[Discipulus]: yes LanX.. is so good to be appreciated (I fortunately have a big self estimation that compensate)
[LanX]: you can manipulate a html tree by addressing and replacing so called document objects (DOM) and from my experience the same methods can be used with any XML, though I didn't test all browsers yet
LanX just joking, playing "ego judo"
[marto]: good morning all
[Corion]: Hi marto!
[marto]: the race to the bottom continues, many people lost their job yesterday as a client moves to another outsourcer
[LanX]: brexit or perlxit ?
[Corion]: Ow, marto :-/ I hope you aren't affected (except for the looming dread of more work for the same pay)
[marto]: unrelated

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2017-03-23 09:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (285 votes). Check out past polls.