Windows doesn't read the shebang line. Perl in Windows does parse the shebang line (unlike Perl in unix, which treats it like any other comment), but not for the reason you mentioned.
Update: Corrected problems identified by Celada. Verification of what he/she said:
$ uname -sr
FreeBSD 5.4-RELEASE-p8
$ cat a.pl
#!/usr/bin/perl -w
print undef;
$ a.pl
Use of uninitialized value in print at ./a.pl line 2.
$ perl a.pl
Use of uninitialized value in print at a.pl line 2.
| [reply] [d/l] |
Actually, perl does always parse the #! line, for two reasons:
- To work around old, buggy, or limited kernels that pass the arguments from the #! line incompletely themselves, or not at all.
- As a security precaution: if a script says it wants taint checks in the #! line (by having -T included there), but the -T switch was not in fact found on the real command line, perl will complain and die rather than run without taint checks.
The relevant quote from the perlrun manpage:
The #! line is always examined for switches as the line is being
parsed. Thus, if you’re on a machine that allows only one argument
with the #! line, or worse, doesn’t even recognize the #! line, you
still can get consistent switch behavior regardless of how Perl was
invoked, even if -x was used to find the beginning of the program.
(but it's certainly an ugly hack that it does this. After all, the idea of the shebang was that the interpreters so invoked wouldn't even be aware of its existence.)
| [reply] [d/l] [select] |
Sorry to take so long to reply, but my wife called Friday while I was reading your message to say that our water heater had ruptured and the basement was flooded.
The shebang was mentioned as way to cover the -w switched referenced in Corion's message. Sorry for the confusion.
I would like to reload the perl on the XP box before continuing with this. Unfortunately, I am working from home today because of the plumbing problem and don't have access to the XP system.
I will post what the results are as soon as I get perl reloaded.
| [reply] |
No, it does not. It does not pass the arguments. As you found out.
| [reply] |