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