I'm running ActiveState Perl 5.10.1 on Windows XP.
The following program executes, but produces no output at the command line:
#!c:/perl/bin/perl.exe
use strict;
use warnings;
print "foo\n";
If I remove the shebang line, I get 'foo' shown as the output, as expected.
I get the same result if I execute using file association only (foo.pl
), referencing perl via PATH (perl foo.pl
) or even directly referring to the perl executable (c:\perl\bin\perl.exe foo.pl
).
I don't understand why the script works without the shebang line, but I get no output when the shebang line is present. My understanding is that the shebang line isn't strictly necessary for Perl in Windows, but it's considered good practice in case you want to use switches like -w
...
It makes no difference if I explicitly make the handle STDOUT, i.e. print STDOUT "foo\n";
This is driving me absolutely crazy; any tips would be appreciated.