Using $FH also allows the filehandle to be passed around, assigned, stored in other structures and objects, etc... so that it's a first class thing, not a bag on the back.
I have a collection of "useful widgets" in a module which I use in all my modules and programs. What that currently does is export $STDERR (etc), which is set $STDERR = *main::STDERR{IO}. So my $STDERR is almost as global as STDERR.
This brings the STDxxx filehandles into line with all other filehandles in my code, sharing all the benefits of being first class variables.
If the sub STDERR {*STDERR} worked, then it would be implicitly global and no export of a variable would be required. /sigh/
In reply to Re^2: sub STDERR { *STDERR } -- nearly works !
by gone2015
in thread sub STDERR { *STDERR } -- nearly works !
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |