which perl is an oft discussed subject, but I can't determine the reason for the observed behavior as follows --

On my Mac, I finally did the way I should have always done it... started with a clean machine (OS X 10.3 with perl v5.8.1-RC3), left the stock perl alone, installed Activestate perl v5.8.7 under usr/local/Activestate..., linked the AS perl to ~/bin/perl, and changed my shebang lines to #!/Users/punkish/bin/perl.

[mumbai:~/Sites/test] punkish% which perl /usr/bin/perl [mumbai:~/Sites/test] punkish% perl -v This is perl, v5.8.1-RC3 built for darwin-thread-multi-2level .. [mumbai:~/Sites/test] punkish% ~/bin/perl -v This is perl, v5.8.7 built for darwin-thread-multi-2level .. [mumbai:~/Sites/test] punkish% perl -c test.pl Can't locate CGI/Simple.pm in @INC (@INC contains: /System/Library/Per +l/5.8.1/darwin-thread-multi-2level /Syste.. [mumbai:~/Sites/test] punkish% ./test.pl Content-Type: text/html; charset=ISO-8859-1 <style type="text/css"> .strike {text-decoration:line-through;} .hilite .. [mumbai:~/Sites/test] punkish% ~/bin/perl ./test.pl Content-Type: text/html; charset=ISO-8859-1 <style type="text/css"> .strike {text-decoration:line-through;} .hilite ..

So, in the terminal I get the factory-installed perl because it is in the path, while my own perl is not in the path. I can even understand why the shebang line is ignored when I call perl test.pl (although it seems that the purpose of the shebang line is defeated -- "what is the purpose of the shebang line?"). But, to confirm the "sense" of the behaviour, shebang line comes into play only when the perl interpreter is not called directly?

Interestingly, while #!/Users/punkish/bin/perl works, and ~/bin/perl test.pl works, #!~/bin/perl fails. So, seems like shell expansion of ~ is not done in a shebang line.

--

when small people start casting long shadows, it is time to go to bed

In reply to #! -- why doth thou exist? by punkish

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.