in reply to Re: $foo = << "END"
in thread $foo = << "END"

Ya thats right but we could have directly written as
my $foo =" This is some text that will be placed in the scalar \$foo. Variables like $this and $that will be interpolated." print $foo;
Does using  << "END" have any specific advantage?

Replies are listed 'Best First'.
Re^3: $foo = << "END"
by choroba (Cardinal) on Mar 05, 2012 at 14:06 UTC
    You can include double quotes without escaping.

      Also, sometimes they make indentation and blank lines clearer. You can include those with multi-line quoted strings, but that's not always as clear. For one thing, you can't justify the first line to the left without adding a newline at the beginning. These are equivalent, and I think the first is clearer:

      my $foo = <<END; paragraph 1 line 2 paragraph 2 line 2 END my $bar = qq| paragraph 1 line 2 paragraph 2 line 2 |;

      Aaron B.
      My Woefully Neglected Blog, where I occasionally mention Perl.

Re^3: $foo = << "END"
by runrig (Abbot) on Mar 05, 2012 at 16:11 UTC
Re^3: $foo = << "END"
by aaron_baugher (Curate) on Mar 05, 2012 at 23:08 UTC

    Except that your example is not the same. Yours has a leading space that mine doesn't have, and mine has a trailing newline that yours doesn't. Those are things that can be more easily spotted with a heredoc.

    On the other hand, some things can be tricky to do with a heredoc, like ending a multi-line string without a newline. So each method has its own best uses.

    Aaron B.
    My Woefully Neglected Blog, where I occasionally mention Perl.