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.
In reply to Re: Difference b/w my and local var?
by ikegami
in thread Difference b/w my and local var?
by anbutechie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |