in reply to Re: How to determine the path to the Perl binary that executed your program?
in thread How to determine the path to the Perl binary that executed your program?

Unfornately, $ENV{_} doesn't work on Windows. Thanks though.
  • Comment on Re^2: How to determine the path to the Perl binary that executed your program?

Replies are listed 'Best First'.
Re^3: How to determine the path to the Perl binary that executed your program?
by demerphq (Chancellor) on Sep 29, 2006 at 07:50 UTC

    If you can ensure that perl is called with an explicit interpreter, either by fully qualifying the path or by using the Windows extension mechanism then $^X should be reliable.

    ---
    $world=~s/war/peace/g

      I'm probably misunderstanding you, but even if perl is invoked without explicit path info and is found through the path environment variable, $^X is still correctly set:

      C:\test>perl -le" print $^X" C:\Perl\bin\perl.exe C:\test>..\perl\bin\perl -le" print $^X" C:\Perl\bin\perl.exe

      The only way I know of getting a different value for the path in $^X is if it is invoked via a subst (or NET USE) drive:

      C:\test>subst p: c:\perl\bin C:\test>p:perl -le" print $^X" P:\perl.exe

      Even then, so long as the subst remains in force, $^X remains valid for all normal uses.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        Hrmmmm.... You know what. I plead lack of coffee. I'm thinking of $0. *blush*.

        ---
        $world=~s/war/peace/g