Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Can't include a HEREDOC within RHS of a Regex

by 7stud (Deacon)
on Jun 15, 2011 at 06:38 UTC ( [id://909728]=note: print w/replies, xml ) Need Help??


in reply to Re: Can't include a HEREDOC within RHS of a Regex
in thread Can't include a HEREDOC within RHS of a Regex

...and that syntax applied to the simpler version:

use strict; use warnings; use 5.010; my $data = "greeting"; $data =~ s{greeting} {my $repl = <<"END_OF_STR"; "$repl goodbye mars"; }e; hello world END_OF_STR say $data; --output:-- hello world goodbye mars

Replies are listed 'Best First'.
Re^3: Can't include a HEREDOC within RHS of a Regex
by ikegami (Patriarch) on Jun 15, 2011 at 07:24 UTC

    ...and that syntax applied to the simpler version:

    While your code is quite revealing, your explanation leaves to be desired. You seem to be saying the following snippets are equivalent:

    print "a", <<"END_OF_STR", "c"; b END_OF_STR
    print "a", <<"END_OF_STR", "c"; b END_OF_STR

    They're not.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-03-28 13:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found