in reply to difference between my and local
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: difference between my and local
by Eimi Metamorphoumai (Deacon) on Nov 15, 2005 at 14:10 UTC | |
by Moron (Curate) on Nov 15, 2005 at 14:26 UTC |