If you have a local that looks like this:you can think of it purely in terms of run-time assignments:{ local $var = $newvalue; some_func(); ... }The difference is that with local the value is restored no matter how you exit the block, even if you prematurely return from that scope.{ $oldvalue = $var; $var = $newvalue; some_func(); ... } continue { $var = $oldvalue; }
Regardless of or what variable you are local'ing in your sub, it should return it to it's orriginal value on exit -- and it certainly shouldn't affect the callers scope.
In reply to Re: Don't local(@_)
by hossman
in thread Don't local(@_)
by simonm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |