http://qs1969.pair.com?node_id=737632


in reply to #!/usr/bin/perl vs. -*- perl -*-

My reading of perlrun suggests that Perl's behaviour is subtle:

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...
appears to say that:

So, Perl does more or less what you want. It has partly adopted the #! convention, so that even if it has no bearing on where the perl interpreter is run from, it still affects switches -- in a system independent manner.

Update: except for -T as brother Hue-Bond points out below :-(

Replies are listed 'Best First'.
Re^2: #!/usr/bin/perl vs. -*- perl -*-
by Hue-Bond (Priest) on Jan 21, 2009 at 16:07 UTC
    • however, in any event Perl will parse the #! line itself and honour switches and stuff. So, if the system doesn't do it, or you run your program by (for example) perl my_wonderful_program.pl ...., you still get the switches from the #!.

    Yes but the -T switch wants to be in the command line too. perldiag explains that this is because when perl sees the -T switch, it's too late to taint some things.

    --
    David Serrano