in reply to typeglobs and filehandles
So in the snippet a new typeglob is produced, made temporarily accessible under a new name, is unaliased and returned. It is no longer accessible under that name (though it remembers the name it was created as) but continues to exist because you can still get at it.
Cute, huh? :-)
One gotcha though. Suppose you have a hash of filehandles. Well you cannot do:
and have it work as expected since the semantics of Perl's parsing are ambiguous. You really need to (sorry) copy the filehandle into a variable and use that variable as the filehandle.while (<$fh_of{$whatever}>) { # ... }
|
---|