in reply to Difference b/w my and local var?
They don't do the same thing at all.
my creates a new variable that's only visible to the scope in which it's defined.
local doesn't create a variable. local temporary saves the variable and restores it at the end of the scope. Unlike my, local does not limit the scope of the variable. If the variable being localized is a package variable (and it usually is), it's still globally accessible after being localized.
Always use my whenever possible.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Difference b/w my and local var?
by ig (Vicar) on Mar 11, 2009 at 23:34 UTC |