--- name: fileno status: documented runtime: pp source: src/runtime/pp/fileio.rs --- ```{index} single: fileno; Perl built-in (pp runtime) ``` # fileno ## Synopsis ```perl $fd = fileno(STDIN); # 0 $fd = fileno(STDOUT); # 1 $fd = fileno($fh); # fd number or undef ``` ## Description 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. ## See also open, close, IO::Handle