in reply to $foo = << "END"
It throws an error, because that's an incomplete statement. What you have there is most of the first line of a heredoc, which when completed looks like this:
my $foo = << "END"; This is some text that will be placed in the scalar \$foo. Variables like $this and $that will be interpolated. END print $foo;
A couple of gotchas on using heredocs: note that the opening line has a closing semicolon and the closing one does not. (I think PHP's heredoc works the other way around.) Also, the closing delimiter word must not have any whitespace on the line before it, unless you go to some trouble to quote the same whitespace as part of the opening delimiter.
Aaron B.
My Woefully Neglected Blog, where I occasionally mention Perl.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: $foo = << "END"
by akagrawal3 (Beadle) on Mar 05, 2012 at 14:01 UTC | |
by choroba (Cardinal) on Mar 05, 2012 at 14:06 UTC | |
by aaron_baugher (Curate) on Mar 05, 2012 at 15:38 UTC | |
by runrig (Abbot) on Mar 05, 2012 at 16:11 UTC | |
by aaron_baugher (Curate) on Mar 05, 2012 at 23:08 UTC |