eval{<$arg>} was my third thought. But testing reminded me that <...> doesn't give you any reasonable way to distinguish "end of file" from "error reading".
I don't understand how eval could be employed since the following program does not die when you read from <$fh>:
my $fh = 'f.tmp'; my $s = <$fh>; print "i am here: s='$s'\n";
That is, there is nothing to catch.
In reply to Re: Re^2: Function that accepts either a file name or a handle
by eyepopslikeamosquito
in thread Function that accepts either a file name or a handle
by eyepopslikeamosquito
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |