in reply to How do I find out if STDIN or STDOUT are attached to a pipe?
But AFAIK you can't tell if STDIN has a pipe attached to the other end of it e.gopen(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
Which is why the - option is common in many *nix command-line tools.echo "foo bar baz" | perl -ne 'print uc' # is the same as (in terms of content) perl -ne 'print uc' foo bar baz ^D
_________
broquaint
|
|---|