http://www.perlmonks.org?node_id=462746


in reply to Perl thinks it's the shell!

From perlrun,

If the #! line does not contain the word ``perl'', the program named after the #! is executed instead of the Perl interpreter. This is slightly bizarre, but it helps people on machines that don't do #!, because they can tell a program that their SHELL is /usr/bin/perl, and Perl will then dispatch the program to the correct interpreter for them.

Also, I believe Apache uses the #! line rather the file association.

On a related note, (again from perlrun)

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.

so -w and other switches on the #! line will work in Windows, even though Windows doesn't know about the #! line.