Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Re: Re: This is really a Perl BUG with my?! Need some advice...by chromatic (Archbishop) |
on Jan 24, 2004 at 09:08 UTC ( [id://323807]=note: print w/replies, xml ) | Need Help?? |
What would you expect this code to do?
You're doing the same thing without changing scope. Sometimes you ask Perl to create a new lexical in the pad, sometimes you don't. Since the sub reuses its pad between invocations and since destroying and recreating all lexicals in a pad is an expensive operation, if the my doesn't fire, you end up reusing the previous variable. Update: Highlighted the important bit that I'd already explained.
In Section
Seekers of Perl Wisdom
|
|