Local scope for file handles?

Jay Buffington Jay at Buffington.net
Wed May 10 17:00:42 CDT 2000


You could use Typeglobs, but that's icky, (unless you're pre 5.0 - then
you'll have to)

The best way to do it is through the FileHandle module.  i.e.:

#Use FileHandle;
#
#sub printfile($) {
#        my $filename = shift;
#        my $filehandle = FileHandle->new();
#        open $filehandle, $filename or die "Can't open $filename";
#
#        while (<$filehandle>) { print; }
#}

Hope this helps

Jay



More information about the Columbia-pm mailing list