in reply to Re^3: What is the right way of concatenating strings
in thread What is the right way of concatenating strings

my $input = do { local $/; <AA> };
uses twice as much memory as
my $input; { local $/; $input = <AA>; }
but the files I use are usually to small to cause me to care.

Supporting evidence

Replies are listed 'Best First'.
Re^5: What is the right way of concatenating strings
by GrandFather (Saint) on May 02, 2006 at 22:01 UTC

    Thanks for that. I considered saying that the first version used memory proportional to twice the file size, but I wasn't sure. In any case it is transient and, as you say, for small files it doesn't matter.


    DWIM is Perl's answer to Gödel