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
.



Relevant Pages

  • Re: Training in the Middle and Far East
    ... East have much to do with basic computer science, and if so, we can suggest ... Rob, you are completely out of line with that question on this list. ... I don't think this list or Perl for that matter prerequisites Computer ... The fact that Randall occasionally answers posts means that the list is ...
    (perl.beginners)
  • RE: Pattern Match
    ... Rob, can you explain the details of that replace? ... > I am very new to Perl, but I sense a great adventure ahead after just ... not a list of characters. ... to the ASCII value of the control character grabbed by the regex. ...
    (perl.beginners)
  • Re: Array containment
    ... Your solution was clever, I think, and may even have ... Rob knows how to save you less than one second. ... If you want useful, maintainable, cute, and usually fast enough, write Perl. ...
    (perl.beginners)
  • Re: Could I put commands in a variable
    ... I don't know, Rob. ... > lot of deprecated constructs in Perl!) ... Like, "C has a goto?". ... much to Perl specifically as to modern programming in general. ...
    (perl.beginners)
  • Re: Training in the Middle and Far East
    ... Rob, you are completely out of line with that question on this list. ... I don't think this list or Perl for that matter prerequisites Computer ... The fact that Randall occasionally answers posts means that the list is ... Windows type Operating Systems.. ...
    (perl.beginners)