On 25/02/2012 00:57, Sean Murphy wrote:
Hi Rob,
Thanks for that. I have spent 30 mins on it and was pulling out my
hair. The end of the heredoc had a tab in front. I didn't know this
mattered. I had the "tag" included and removed for the heredoc. But I
got an error when compiled without the quotes around the Heredoc tag.
Now I know why. This is the first time I ever have used heredocs.
Far better then other ways I have done it.
It all works now.
Great!
You can put the here doc target in quotes, and so include some leading
space if you really want to indent it:
print <<" HERE";
my
text
ends
HERE
but that is a bit iffy as you have to count invisible whitespace to get
it right. Or you can use underscores, which are a sort of visible padding:
print <<____HERE;
my
text
ends
____HERE
There's a lot of useful stuff in the documentation. Here docs are
documented in
perldoc perlop
at the section starting with <<EOF. And there is a section in the faqs at
perldoc -q "here doc"
Cheers,
Rob
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/