in reply to More than one way to do it???

You can use the ttyname() function in POSIX to get this:
use POSIX; $tty = ttyname(0);