in reply to How do I find out if STDIN or STDOUT are attached to a pipe?
if (-t) { # STDIN is attached to a terminal # that is, we're running interactively ... } [download]
-- Randal L. Schwartz, Perl hacker