Well, some of us have more than one perl binary on our system. e.g., a recent thread where the question was how to upgrade perl, my suggestion, echoed by wazoox, was to leave the system perl alone, and compile the desired perl into a new location. (You can read that thread to see why, but it's not relevant to this node.)

So, if you want to know which perl binary that executed your program, it could be the one in /usr/bin (the system perl), or it could be the one in /usr/local/bin (the local version). The one you find is going to be based on the PATH - does /usr/local/bin come before /usr/bin? However, the one that is actually used might be the one in the PATH (if you're running it by running "perl myscript"), or it might be the one in the shebang line, which could be either perl.

In fact, I have had multiple perls installed: /usr/bin/perl, /usr/bin/perl5.8, /usr/bin/perl5.8.7, /usr/bin/perl5.8.8, all at the same time. Your "whereis perl" would get the wrong one because I nearly always used a shebang line for #!/usr/bin/perl5.8.8. But $^X got it right. Which is good - it helped when compiling modules (perl5.8.8 Makefile.PL would result in a Makefile that used the right perl!).


In reply to Re^2: How to determine the path to the Perl binary that executed your program? by Tanktalus
in thread How to determine the path to the Perl binary that executed your program? by Anonymous Monk

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.