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.