heredoc

In Perl, you can create a heredoc with the following syntax.

$a_variable = <<"eof";
This is a variable
that contains
a bunch of text on
a bunch of lines. That's the benefit of
using heredocs - you don't have to print
line by line.
eof

Note here that there is a semi-colon after the first line ... "eof"; but none after the last line eof. This is important. Also, the eof part, that's up to you. Put anything there you like. eof generally stands for end of file, or eol end of line. I'm not sure why I use eof, but I do.

Just for reference, in PHP, a heredoc looks like

$a_variable = <<<eof
This is a variable
that contains
a bunch of text on
a bunch of lines. That's the benefit of
using heredocs - you don't have to print
line by line.
eof;

Page Comments (Click to edit)






[Click to add or edit comments])

Please prepend comments below including a date

Design by N.Design Studio, adapted by solidGone.org (version 1.0.0)
Have a nice day.