in reply to More than one way to do it???
An immediate improvement that springs to mind is in the regex - change it to simply remove the '/dev/' at the beginning of the string:
perl -we '$tty=qx(tty);$tty=~s!^/dev/!!;print $tty'
In Section
Seekers of Perl Wisdom