# the following line is correct Python but not correct Perl
from collections import namedtuple
$ ln -s /usr/bin/perl /tmp/p
The documentation for this feature is found in perlrun.
#!line does not contain the word "perl" nor the word "indir", 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.
So, if the shebang contains
indir, a new interpreter isn't executed.
Additionally, the interpreter isn't executed if it's the same as
$^X is set varies by system, explaining the differences you observed.