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;