In the outer scope, you could argue you don't need local because you can theoretically assign a localised $fred to the value of global $fred with just my $fred = $fred;. But in the inner scope, local provides the only means of access to global $fred (other than referencing it by package name) because otherwise access to global $fred is blocked by the presence of outer scope's $fred.# main scope $fred = 1; #global #... { # outer scope my $fred = 2; #... { #inner scope #... } }
-M
Free your mind
In reply to Re: difference between my and local
by Moron
in thread difference between my and local
by jeanluca
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |