fileno
Returns the underlying OS file descriptor for a Perl filehandle.
Returns the numeric file descriptor associated with the given
filehandle, or undef if the handle is not connected to a real OS
file descriptor (e.g. in-memory handles, closed handles).
Accepts bareword filehandles (STDIN), lexical filehandles ($fh),
and IO::Handle / IO::File objects (blessed hashrefs with __fh_id).
The standard streams always return their well-known descriptors: STDIN = 0, STDOUT = 1, STDERR = 2.
Synopsis
$fd = fileno(STDIN); # 0
$fd = fileno(STDOUT); # 1
$fd = fileno($fh); # fd number or undef