Dear monks,

Just wondering what the deal is with invoking a shell script with

#!/bin/sh #-*- perl -*- exec perl -x $0 "$@"
Rather than the "usual" (or should that be "beginner"?) method:
#!/usr/bin/perl
In perlrun it says something about being sure that Perl can read your switches---is this the only reason?

I originally thought it had something to do with portability between systems, but now think that may not be true because some systems don't recognise the shebang line at all.. or does that not matter when you invoke it the first way?

Then I thought that it might be for people who keep their perl in weird places or who want to be able to switch between versions of perl easily. Is that right? It seems most plausible!

I've tried searching with Google, but it just ignores all special characters, so no luck there. (This annoys me a lot actually, that they don't have some facility for specfically including special characters in the search.. on a complete tangent does anyone know a search engine that does?? or is there a way to make Google behave as I want?)

Cheers
why_bird
........
Those are my principles. If you don't like them I have others.
-- Groucho Marx
.......

In reply to #!/usr/bin/perl vs. -*- perl -*- by why_bird

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.