in reply to Test for standard input
testing STDIN with -t might help - see perlfaq - How do I know if I'm running interactively or not?.
Sorry, I think I misunderstood the FAQ here - -t doesn't seem to work as I thought.
update: After some more reading, I think it can't be done. it's easy to differentiate between these two
by looking at $ARGV, but I'm not sure perl can even know the difference between these twoperl -ne 'print' /path/to/file cat /path/to/file | perl -ne 'print'
cat /path/to/file | perl -ne 'print' perl -ne 'print'
-- Dan
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Test for standard input
by goldclaw (Scribe) on Oct 03, 2002 at 17:07 UTC | |
by rowswell (Initiate) on Oct 03, 2002 at 17:22 UTC | |
by sauoq (Abbot) on Oct 03, 2002 at 18:36 UTC | |
by mikfire (Deacon) on Oct 03, 2002 at 18:05 UTC | |
by BUU (Prior) on Oct 03, 2002 at 23:57 UTC | |
by mikfire (Deacon) on Oct 04, 2002 at 04:07 UTC |