#!/usr/bin/perl use strict; use warnings; my $HFILE; my $hfile = 'foo.txt'; # GOOD ##################################################################### # Bareword filehandle works with space following heredoc "<<". ##################################################################### open(HFILE, '>', $hfile) or die "Error opening help file $hfile: $!\n"; print HFILE << "EOT"; Usage: foo.pl Options: -------- -h Display help information. EOT # BAD ##################################################################### # Lexical filehandle does NOT work with space following heredoc "<<". ##################################################################### open($HFILE, '>', $hfile) or die "Error opening help file $hfile: $!\n"; print $HFILE << "EOT"; Usage: foo.pl Options: -------- -h Display help information. EOT