note
gone2015
<p>My reading of [doc://perlrun] suggests that Perl's behaviour is subtle:<blockquote>
The <c>#!</c> 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 <c>#!</c> line, or worse, doesn't even recognize the <c>#!</c> line, you still can get consistent switch behavior regardless of how Perl was invoked...
</blockquote>appears to say that:</p>
<ul>
<li><p>if you happen to be running on a system that implements the <c>#!</c> trick, and invoke your Perl program in a way that causes the system to use the <c>#!</c>, then that's fine -- you'll get as many switches and such as the system is prepared to give you.</p></li>
<li><p>however, <u>in any event</u> Perl will parse the <c>#!</c> line <u>itself</u> and honour switches and stuff. So, if the system doesn't do it, or you run your program by (for example) <c>perl my_wonderful_program.pl ....</c>, you still get the switches from the <c>#!</c>.</p>
<p>The documentation goes on to discuss what happens if switches appear both in the command line and in the <c>#!</c>, and to tell you that <c>perl</c> needs to appear somewhere on the line for Perl to be interested in it.</p></li>
</ul>
<p>So, Perl does more or less what you want. It has partly adopted the <c>#!</c> 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.</p>
<p><b>Update: </b>except for <c>-T</c> as brother [Hue-Bond] points out [id://737868|below] :-(</p>
737548
737548