in reply to Re: assign a string using multiline format
in thread assign a string using multiline format

... It is interpolated, so any vars inside the HEREDOC is also expanded

it doesn't have to be interpolated, see the following...

print <<'END'; $foo was here and here END # will print $foo was here and here
---
my name's not Keith, and I'm not reasonable.

Replies are listed 'Best First'.
Re^3: assign a string using multiline format
by danmcb (Monk) on Aug 26, 2005 at 13:17 UTC
    why will punkish' HEREDOC interpolate while heith's won't? I don't see the difference ...?
      heredocs are interpolerated the same way, as the termination string is, so <<EOF is the same as <<"EOF", but <<'EOF' won't be interpolerated.
      read perldoc perlop -> Regexp Quote-Like Operators -> <<EOF
      my $foo = 'bar'; print <<END; 1. \$foo is $foo END print <<"END"; 2. \$foo is $foo END print <<'END'; 3. \$foo is $foo END print <<`END`; echo 4. \$foo is $foo END
      results in
      1. $foo is bar 2. $foo is bar 3. \$foo is $foo 4. $foo is bar
      See perlop#Quote-and-Quote-like-Operators.