in reply to Accepting either a filename or a handle

There's a function in Module::Locate that determines whether a scalar acts like a filehandle or not. So with that you could do something like this in your function
use Module::Locate 'acts_like_fh'; sub fizbin { my($str, $infh, $outfh) = @_; -e $_ or acts_like_fh $_ or die "Invalid file name/handle '$_'" for $infh, $outfh; ... }
HTH

_________
broquaint