in reply to Detecting the current terminal

chop (my $tty = `tty`); if ($tty =~ /tty\d/) { # console ... } else { # network ... }