in reply to How do I find out if STDIN or STDOUT are attached to a pipe?

You can use the -p file test to check whether a filehandle is a pipe e.g
open(my $handle, "|date") or die("ack - $!"); print '$handle is a pipe', $/ if -p $handle; print while <$handle>; __output__ $h is a pipe Fri Jun 21 17:10:26 GMT 2002
But AFAIK you can't tell if STDIN has a pipe attached to the other end of it e.g
echo "foo bar baz" | perl -ne 'print uc' # is the same as (in terms of content) perl -ne 'print uc' foo bar baz ^D
Which is why the - option is common in many *nix command-line tools.
HTH

_________
broquaint