perl-unicode
|
Re: Help slurping a file?2005-10-28 09:32:58You 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__
|
|