Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Re: Question regarding variable scopeby MarkM (Curate) |
on Oct 17, 2003 at 05:33 UTC ( [id://299940]=note: print w/replies, xml ) | Need Help?? |
Actually, my() and our() do not behave the same from a subroutine. Both define a lexical context for the variable, however, my() allocates a new variable each time it is evaluated, while our() reuses a global. For recursive subroutines, or subroutines that are accessed at the same time from multiple threads, my() variables are safe, while our() variables are unsafe.
In Section
Seekers of Perl Wisdom
|
|