http://qs321.pair.com?node_id=1108202


in reply to Detect piped input

You can detect if the input is a terminal, which should tell you the corollary:

print 'pipe' unless -t;