There's more than one way to do things | |
PerlMonks |
Re: (proposed)Scoping tutorialby Dominus (Parson) |
on Dec 20, 2000 at 02:34 UTC ( [id://47496]=note: print w/replies, xml ) | Need Help?? |
> Since local only works on globals, you can't use it on a my variable...It's good to realize that this restriction is entirely arbitrary. In principle, there's nothing wrong with the idea of giving a my variable a new value temporarily, and arranging for its old value to return automatically, later on, which is what local does. Someone (I think Chip) even contributed a patch to Perl to enable this. But Larry thought it might be confusing, and rejected it.
In Section
Meditations
|
|