in reply to Re^5: How do closures and variable scope (my,our,local) interact in perl?
in thread How do closures and variable scope (my,our,local) interact in perl?

To clarify...

$y = 123; sub f { print("$y\n"); } # 456 or 123 { local $y = 456; f(); } # Same var, localized f(); # same var, global __END__ 456 123
my $x = 123; sub f { print("$x\n"); } # 123 { my $x = 456; f(); } # Different var f(); __END__ 123 123

my vars are static, local vars are dynamic. Again - my/local, space/time (was: Re: The difference between my and local)