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
In reply to Re: Testing <>
by Corion
in thread Testing <>
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |