Instead of processing the text file, the script just terminates as if the file was empty or the STDIN handle closed. It doesn't even process a single line in the text file.
Yes, it is a known problem, and somewhat of a pita. But if you use *ARGV's magic, a.k.a. the diamond operator <> you can safely specify the file on the command line just fine, and this is generally all you need:
C:\temp>cat test.pl #!/usr/bin/perl -0777 use strict; use warnings; print scalar <>; __END__ C:\temp>test.pl test.pl #!/usr/bin/perl -0777 use strict; use warnings; print scalar <>; __END__
I also tried the example at http://perlmonks.org/?node_id=191787 and get the same problem.
Please use [id://191787] to render an internal link like Re: Re: Re: redirecting stdin on windows.
In reply to Re: Redirecting STDIN on Windows commandline
by blazar
in thread Redirecting STDIN on Windows commandline
by billy3
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |