in reply to how to tell if STDIN is a tty

The -t filehandle test should do just fine.

japhy -- Perl and Regex Hacker