Subject: Re: CVS commit: pkgsrc/pkgtools/pkglint/files
To: Christoph Badura <bad@bsd.de>
From: Roland Illig <rillig@NetBSD.org>
List: pkgsrc-changes
Date: 09/20/2006 22:59:22
Christoph Badura wrote:
> On Mon, Sep 18, 2006 at 10:07:21AM +0000, Roland Illig wrote:
> 
>>The cause for the memory leak was that I wrote
>>	my ($result) = @_;
>>instead of
>>	my ($result) = ($1);
>>after successfully matching a regular expression.
> 
> 
> And if you wrote that in the natural way as
> 
> 	my $result = $1;
> 
> Perl wouldn't have to create a list and figure out if it can optimise
> it away.

It's all for consistency. I have many such code snippets where I save 
($1, $2, $3, $4) in variables.

I haven't yet measured if it would be worth optimizing it by removing 
the parentheses. But looking at the Perl source code (pp_sassign vs. 
pp_aassign) it may well be worth.

Roland