good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Unusual Closure Behaviourby paulbort (Hermit) |
on Jul 12, 2001 at 21:08 UTC ( [id://96114]=note: print w/replies, xml ) | Need Help?? |
The word that I keep seeing left out of these replies is 'precedence'. It looks to me like there is confusion between
my ($x if undef);
and
(my $x) if undef;
It looks to me like you are expecting the latter and getting the former. I suspect 'if' is being evaluated as an operator, so it gets a higher precedence than the 'my' function, and confusion results.
Or I could be completely wrong.
In Section
Seekers of Perl Wisdom
|
|