I\'m trying to handle the possibility that no arguments and no piped data is passed to a Perl script. I\'m assuming that if there are no arguments then input is being piped via
use POSIX 'isatty';
if ( ! @ARGV && isatty(*STDIN) ) {
die "usage: ...";
}
See: http://www.opengroup.org/onlinepubs/009695399/functions/isatty.html
Note that select wouldn't be much help anyway, since it would produce false results if the piped info wasn't ready yet. Example:
seq 100000|grep 99999|perl -we'$rin="";vec($rin,fileno(STDIN),1)=1;print 0+select($rin,"","",.01)'