Beau E. Cox wrote:
> Hi -
> 
> I want to determine is a variable is a file handle.
> 
> How would I do this?
> 
> I know how to tell if it is a ref to something,
> but I can't seem to be able to find out if it
> is a file handle.
> 
> Aloha => Beau/

UNIVERSAL::isa($var, 'GLOB') should do the trick. This works for IO::File
and similar objects as well as those created by open(my $fh, ...).

If you want to see if a file is actually open on that handle, you can do
something like:

UNIVERSAL::isa($var, 'GLOB') && eval { $var->opened }

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to