local doesn't create variables. It just backs up the value of the variable and restores it later.
I know *. Certainly there's an internal difference; but it seems to me that the casual user is not likely to encounter much difference between
andour $x; CODE INVOLVING OUTER $x { local $x; CODE INVOLVING INNER $x }
That's by no means to say that there is no difference—indeed,my $x; CODE INVOLVING OUTER $x { my $x; CODE INVOLVING INNER $x }
shows that there is—just that one's not likely to see it in casual use.our $x; my $y; sub twiddle { $x = $y = 'twiddled' } { local $x = 'local?'; my $y = 'local!'; twiddle; say $x, ', ', $y; }
* Ah, but re-reading shows that I didn't seem to understand: I said something about having two variables with the same name, when really the localised $x is the same variable as the original one, just with a ‘temporary’ value. Is that misstatement on my part what you were correcting?
In reply to Re^8: type glob
by JadeNB
in thread type glob
by 7stud
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |