in reply to Scope surprise
Of course, I did have to drop the "use strict;" to make it work, because local is not a variable declaration. You can still prepend "our $foo;" to add the actual declaration, and strict will no longer complain.local $foo = 1; foo(); local $foo = 2; sub foo { print "foo: $foo\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Scope surprise
by ikegami (Patriarch) on Apr 11, 2009 at 18:58 UTC | |
by bart (Canon) on Apr 11, 2009 at 20:23 UTC | |
by ikegami (Patriarch) on Apr 11, 2009 at 20:53 UTC |