use strict; MAIN: { my $fh; open($fh, ">hdt.html") or die("Unable to open output file!"); my $title = 'MY TTILE'; print $fh < $title Blah, Blah... EOF close $fh; } #### use strict; MAIN: { my $args = {}; open($args->{fh}, ">hdt.html") or die("Unable to open output file!"); my $title = 'MY TTILE'; print $args->{fh} < $title Blah, Blah... EOF close $fh; } #### D:\Development\Perl\HereDocTest>hdt2.pl
Scalar found where operator expected at D:\Development\Perl\HereDocTest\hdt2.pl line 10, near "$title"<br> (Missing operator before $title?)<br> Bareword found where operator expected at D:\Development\Perl\HereDocTest\hdt2.pl line 11, near "</head"<br> (Might be a runaway multi-line // string starting on line 10)<br> (Missing operator before head?)<br> Bareword found where operator expected at D:\Development\Perl\HereDocTest\hdt2.pl line 13, near "Blah"<br> (Missing semicolon on previous line?)<br> syntax error at D:\Development\Perl\HereDocTest\hdt2.pl line 9, near "head>"<br> Search pattern not terminated at D:\Development\Perl\HereDocTest\hdt2.pl line 15<br> ##</code><code>## use strict; MAIN: { my $args = {}; open($args->{fh}, ">hdt.html") or die("Unable to open output file!"); my $title = 'MY TTILE'; my $fh = $args->{fh}; print $fh <<EOF; <html> <head> <title>$title Blah, Blah... EOF close $fh; } ##
## print ($args->{fh}) <{fh} <{fh}) <