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

Dixonian alias (was: Re: Schwartzian alias)

From:
Dr.Ruud
Date:
January 14, 2009 07:37
Subject:
Dixonian alias (was: Re: Schwartzian alias)
Message ID:
20090113211437.10786.qmail@lists.develooper.com
Dr.Ruud wrote:

> 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> }

Oops, it was actually Rob Dixon that coined it.

-- 
Ruud



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