develooper Front page | perl.perl5.porters | Postings from September 2005

Re: [perl #7615] (if|unless) ( local ... ) not undone

From:
Michael G Schwern
Date:
September 10, 2005 14:08
Subject:
Re: [perl #7615] (if|unless) ( local ... ) not undone
Message ID:
20050910210801.GD7622@windhund.schwern.org
On Fri, Aug 26, 2005 at 09:06:50AM -0700, Steve Peters via RT wrote:
> > $a = 10;
> > if (local $a = 1){
> > }
> > print $a; # Should be 10, not 1

Still busted in 5.8.6 and blead.

$ bleadperl -wle '$a = 10;  if( local $a = 1 ) {}  print $a'
Found = in conditional, should be == at -e line 1.
1
$ bleadperl -wle '$a = 10;  if( my $a = 1 ) {}  print $a'
Found = in conditional, should be == at -e line 1.
10


-- 
Michael G Schwern     schwern@pobox.com     http://www.pobox.com/~schwern
'All anyone gets in a mirror is themselves,' she said. 'But what you
gets in a good gumbo is everything.'
	-- "Witches Abroad" by Terry Prachett



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