Re: Help slurping a file?

[email protected] (David Graff)
Newsgroups perl.unicode
Message-ID <[email protected]>
You probably noticed that I forgot to localize $/ in that snippet I sent
previously (not that it matters in this case -- just a point of maintaining
good habits):

#!/usr/local/bin/perl

my $fname = "path/name_of.file";
open( IN, $fname );
{
    local $/ = undef;
    $_ = <IN>;
}
close IN;

printf("File size = %d, slurped string size = %d\n", -s $fname, length());

__END__
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.