in reply to sub and anonymous sub
Yes, the localization for the variable doesn't happen until the end of the statement, so the value on the right is the previous value (plus one), and it's undone at the end of the block.sub my_sub { local $my_sub_level = $my_sub_level + 1; .. }
-- Randal L. Schwartz, Perl hacker
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: �Re: sub and anonymous sub
by BrowserUk (Patriarch) on Jun 20, 2002 at 21:32 UTC | |
by merlyn (Sage) on Jun 20, 2002 at 21:41 UTC | |
by dmmiller2k (Chaplain) on Jun 21, 2002 at 22:02 UTC | |
by thelenm (Vicar) on Jun 21, 2002 at 22:08 UTC | |
by dmmiller2k (Chaplain) on Jun 21, 2002 at 22:22 UTC | |
A reply falls below the community's threshold of quality. You may see it by logging in. |