On Wed, Feb 16, 2005 at 10:14:20PM +0000, Nicholas Clark wrote:
> # Is this really generating 3 independent anonymous filehandles?
> my ($listener, $connector, $acceptor) = map {local *H; *H} 1..3;
Yes. It even makes a weird kind of sense when you think of the GP as
being the value of a GV, just as the IV, NV, PV, RV, or UV is the value
of an SV, and what is returned from the block (and what is localized) is
the value, the GP (with a fresh GV wrapped around it).
It also makes sense that map {local *H; \*H} *doesn't* return refs to
unique globs, since the GV is never actually changed by the localization,
and once outside the block, the GP has been restored.
But I'd use Symbol::gensym anyway.