in reply to I need a simple explantion of the difference between my() and local()
From perldoc perlfaq7:
What's the difference between dynamic and lexical (static) scoping? Between local() and my()?local($x) saves away the old value of the global variable $x, and assigns a new value for the duration of the subroutine, which is visible in other functions called from that subroutine.
...
my($x) creates a new variable that is only visible in the current subroutine.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: I need a simple explantion of the difference between my() and local()
by $code or die (Deacon) on May 02, 2001 at 21:25 UTC | |
by merlyn (Sage) on May 02, 2001 at 21:50 UTC | |
by buckaduck (Chaplain) on May 02, 2001 at 22:28 UTC | |
by $code or die (Deacon) on May 03, 2001 at 07:16 UTC |
In Section
Seekers of Perl Wisdom