in reply to More than one way to do it???
You can use the ttyname() function in POSIX to get this:
use POSIX 'ttyname'; $tty = ttyname(0); [download]