in reply to print or die
It works similarly whenever you want to do something else after the heredoc...print FILE <<UNTIL_I_SAY_STOP or die "ERROR Writing to FILE: $!"; blah, blah, blah UNTIL_I_SAY_STOP
prints out 123.my $sub=substr(<<EOT,3,3); abc123def EOT print "sub=\"$sub\"\n";
You can even get fancy (or hard to read depending on your preference) and use multiple heredocs in the same call:
print <<EOT1,<<EOT2; foo EOT1 bar EOT2
|
|---|