in reply to Testing <>
STDIN is always there.
Maybe you want to detect instead of whether your script is supposed to get interactive input or input piped from a file, or another program?
if( -t and !@ARGV) { die "Need a file or stream on standard input"; }; while (<>) { ... };
>perl -w tmp.pl Need a file or stream on standard input at tmp.pl line 2. >perl -w tmp.pl tmp.pl >perl -w tmp.pl <tmp.pl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Testing <>
by Anonymous Monk on Oct 03, 2011 at 15:49 UTC |