Having a script like
#!/usr/bin/perl print "hello\n";
and running it from the command line using
$ perl script.pl
will use the perl interpreter perl specified on the command line to run the script, no doubt. Same holds true for
#!/some/weird/line/containing/perl print "hello\n";
but I was surprised to see that
#!/usr/local/bin/python print "python!"
when put into script.py and run via
$ perl script.py
(note the perl on the command line) will call the python interpreter without complaining! Also, a script like
#!Some Weird Comment print "perl!";
will throw an error message:
$ perl script.pl Can't exec Some at t1 line 1.
So, the deal is that if the shebang line contains the pattern perl somewhere, perl will actually run the script, whereas when it doesn't contain the perl pattern, it will try to run whatever's specified on the shebang line?

Anybody knows more about this?


In reply to Shebang Line Weirdness by saintmike

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.