develooper Front page | perl.perl5.porters | Postings from January 2009

Schwartzian alias

Thread Next
From:
Dr.Ruud
Date:
January 13, 2009 06:26
Subject:
Schwartzian alias
Message ID:
20090112230345.23807.qmail@lists.develooper.com
On the Perl beginners mailing list, Randal coined a neat idea:

Make Perl alias (rather than copy) when the source will be garbaged 
anyway (like at end of scope).

If only because currently this:

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

uses double the memory of:

   my $txt; { local $/; $txt = <$fh> }

-- 
Ruud

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About