|
Posted by szr on April 2, 2008, 5:28 pm
Please log in for more thread options
David Filmer wrote:
> Ela wrote:
>>> Or a heredoc :-)
>>>
>>> print <<_EOF_;
>>> $foo $bar
>>> _EOF_
>>>
>>
>> There are too few words in your example and I'm unable to
>> follow/Google. I guess maybe you are telling something important? thx
>
> szr is just showing you an example of how to use a heredoc, which
> recognizes the \n at the end of any lines within it (so it's just
> another way of printing newlines).
I should of also said, you can either physically have new lines, like:
print <<_EOF_;
A
B
C
_EOF_
Or you can use \n instead:
print <<_EOF_;
A\nB\nC
_EOF_
Or mix and match:
print <<_EOF_;
A
B\nC
_EOF_
Either way you get:
$ perl -e 'print <<_EOF_;
> A
> B\nC
> _EOF_'
A
B
C
--
szr
|