sub chk_hndl { if (fileno $_[0]) { print "OPEN\n" } else { print "NOT OPEN\n" } } chk_hndl(*FOO); chk_hndl(*STDOUT); # prints: NOT OPEN OPEN