You can pass a bareword filehandle to Perl functions like eof, and you'd like to write similar subroutines of your own.
Use the Symbol module's qualify_to_ref in conjunction with a * prototype on the subroutine:
use Symbol qw(qualify_to_ref); sub my_eof (*) { my $handle = shift; $handle = qualify_to_ref($handle, caller( )); # use $handle }
The documentation for the standard module Symbol (also in Chapter 32 of Programming Perl); the "Prototypes" section in the perlsub(1) manpage (also in Chapter 6 of Programming Perl); Recipe 7.23
Copyright © 2003 O'Reilly & Associates. All rights reserved.