When you use 'local' in to localize a variable, what is really happening is that Perl will store the value of any variable that already has the localized variables name when the localized variable is initialized. When the sub-routine ends and the program returns to the main body, Perl will restore the old value of the original variable. Ex:
$a = "one";
print $a, "\n";
routine();
print $a, "\n";
sub routine {
local $a = "two";
print $a, "\n";
}
The output from this program would be:
one
two
one
-kel