P
Peng Yu
To read a whole file into a string. The following webpage uses
binmode.
http://www.perlmonks.org/?node_id=1952
But the following code from perlvar doesn't. I tried both on linux.
They are identically. But if I want the raw data in the file, I should
always use binmode to be safe across all OS, right?
open my $fh, "<", "foo" or die $!;
local $/; # enable localized slurp mode
my $content = <$fh>;
close $fh;
binmode.
http://www.perlmonks.org/?node_id=1952
But the following code from perlvar doesn't. I tried both on linux.
They are identically. But if I want the raw data in the file, I should
always use binmode to be safe across all OS, right?
open my $fh, "<", "foo" or die $!;
local $/; # enable localized slurp mode
my $content = <$fh>;
close $fh;