in reply to Re^2: input from STDIN or from a file
in thread input from STDIN or from a file
Erm, no it does either arguments or STDIN if none were given just like the documentation in perlop and the code you copied there from says. Read it again:
unshift( @ARGV, '-' ) unless @ARGV;
Put a string '-' (which is shorthand to open to read from STDIN) onto the front of @ARGV unless there are already arguments in @ARGV.
If you're getting the behavior you're seeing out of your test1.pl then something very strange is going on.
$ cat my_test1.pl #!/usr/bin/perl use strict; use warnings; while (<>){ print; } $ cat infile 2 from infile 3 from infile $ echo "testing" | perl my_test1.pl infile 2 from infile 3 from infile
The cake is a lie.
The cake is a lie.
The cake is a lie.
|
|---|