>>>>> "R" == Ruud <[email protected]> writes:
R> Thomas Bätzler wrote:
>> my $data = do {
>> local $/ = undef;
>> <$fh>;
>> };
R> Especially for big files, that is better written as:
define big. most files are still text or similar and not big by today's
ram sizes. slurping in a megabyte is nothing today. back in the day it
would have caused major disk thrashing.
R> my $data;
R> { local $/;
R> $data = <$fh>;
R> }
even better as:
use File::Slurp ;
my $data = read_file( $file ) ;
faster, cleaner, no need for $/ and local.
uri
--
Uri Guttman ------ [email protected] -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/