3 ms·
Agreed, the trick with a local ARGV and the null filehandle is too clever. Don't copy code you don't understand! I think opening the file is much clearer.
by sciurus 15y ago
Agreed, the trick with a local ARGV and the null filehandle is too clever. Don't copy code you don't understand! I think opening the file is much clearer.
open( my $fh, '<', $file ) or die "cannot open $file\n";
my $text = do { local( $/ ) ; <$fh> } ;
http://perldoc.perl.org/perlopentut.html
http://perldoc.perl.org/functions/do.html
http://perldoc.perl.org/functions/local.html
http://perldoc.perl.org/perlop.html#I%2fO-Operators