Re: OO confusion



Randal L. Schwartz wrote:
"Rob" == Rob Dixon <rob.dixon@xxxxxxx> writes:

Rob> But the first causes Perl to keep two copies of the file data, which may be
Rob> unacceptable depending on the the size of the file and the specification of the
Rob> platform.

Does it really? Have you tested this?

I suspect it actually doesn't.

OK, I have just tested

open my $fh, '<:raw', $file or die $!;

followed by

my $data = do {
local $/;
<$fh>;
};

versus

my $data;
{
local $/;
<$fh>;
}

Where $file is a gash 512MB file.

The first results in a 1GB process whereas the second stops at 512MB or so. The
first also takes longer to read the file.

This is using ActiveState Perl v5.8.8 on Windows XP SP3.

Rob
.