ttyname#

The name of the terminal a handle is open on, or undef.

Synopsis#

my $name = IO::Tty::ttyname(\*STDIN);    # e.g. /dev/pts/3

What you get back#

The name, or undef with $! set when the handle is not open on a terminal (or not open at all, EINVAL). Something that is not a handle dies “Bad filehandle”.