The operator <>reads a list of input file names from @ARGV. Thus, one way to set the default input file name is to check @ARGVif it is empty, and if so, click on the default file name:
push @ARGV, "default.txt" unless @ARGV;
, "no STDIN", , script foo.txt default.txt, , , :
perl script.pl < foo.txt
cat foo.txt | perl script.pl
, , STDIN , -t test. STDIN tty, , :
push @ARGV, "default.txt" unless @ARGV or !-t STDIN;