Odd--you're right, though I can't figure out why. The docs seem to say that you get a new glob when you localize:
The construct local *name; creates a whole new symbol table entry for the glob "name" in the current package. That means that all variables in its glob slot ($name, @name, %name, &name, and the "name" filehandle) are dynamically reset.
In any case, the following does work correctly:
open(S1, "/dev/null"); $a=*S1{IO}; { local(*S1); open(S1, "/dev/null"); $b=*S1{IO}; } print "$a $b\n";
IO::Handle=IO(0x101536f8) IO::Handle=IO(0x1013cdec)
=cut
--Brent Dax
There is no sig.
In reply to Re^3: Globs and globals
by BrentDax
in thread Globs and globals
by Eyck
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |