Table of Contents

HERE Docs

The problem:

print "This is a long line of text which might be too long to fit on just one line\n";
print "and I was right, it was too long to fit on one line.  In fact, it looks like it\n";
print "might very well take up to FOUR, yes FOUR lines to print.  That's four print\n";
print "statements, which takes up even more room.  But wait! I'm wrong!  It will take\n";
print "FIVE lines to print this statement!  Or is that six lines? I'm not sure....\n";

The solution:

$var='variable interpolated';

print <<PRT;
This is a long line of text which might be too long to fit on just one line
and I was right, it was too long to fit on one line.  In fact, it looks like
it might very well take up to FOUR, yes FOUR lines to print.  

That's four print statements, which takes up even more room.  But wait! I'm 
wrong!  It will take FIVE lines to print this statement!  Or maybe six lines? 
I'm not sure....but anyway, just to prove this can be $var.
PRT

That's called a 'here' document and you don't need to use PRT, you can use whatever you like within reason. You don't need to put in explicit newlines, although if you do they perform as usual. Now you know about here docs you can stop wearing the print function out by calling it every couple of lines. You don't have to use here docs to print to files, just anywhere you'd normally put a more than one print statement.