Name

openhandle

Synopsis

openhandle fh
                  

Returns fh if fh is an open filehandle. fh may also be a tied filehandle. Returns undef on failure.

my $fh = openhandle(*STDIN);
$fh = openhandle("sumfin"); # undef, since sumfin isn't 
                            # open

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.