develooper Front page | perl.perl5.porters | Postings from December 2010

[perl #45265] my (my $a) is legal syntax

Thread Next
From:
Father Chrysostomos via RT
Date:
December 12, 2010 13:12
Subject:
[perl #45265] my (my $a) is legal syntax
Message ID:
rt-3.6.HEAD-17624-1292188327-1774.45265-15-0@perl.org
On Sat Sep 08 05:33:17 2007, nicholas wrote:
> $ perl -wle 'my (my $a) = 3; print $a'
> 3
> 
> The optree deparses as if there is only one my:
> 
> $ perl -MO=Deparse -e 'my (my $a) = 3;'
> my($a) = 3;
> -e syntax OK
> 
> 
> Shouldn't chained my be a syntax error?

I’d call that a feature. :-)

Isn’t that what allows my(undef) to work?


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