Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^2: different exe path for different OS

by bergbrains (Acolyte)
on Sep 01, 2010 at 14:38 UTC ( [id://858354] : note . print w/replies, xml ) Need Help??

in reply to Re: different exe path for different OS
in thread different exe path for different OS

At least in our case, our scripts are shared via NFS across multiple platforms, so that doesn't make sense, because the requirement is that the exact same script must execute with the platform-specific interpreter when run on different platforms.

Replies are listed 'Best First'.
Re^3: different exe path for different OS
by DrHyde (Prior) on Sep 02, 2010 at 10:13 UTC

    In that case, Brother Salva's answer is the one you want. In this case, using $^X will work, but in general it's good practice to use Config; and then use $Config{perlpath} instead. $^X can sometimes get confused if your original script is invoked with a relative path to perl (eg as ../myperl/bin/perl and then does a chdir before you try to execute $^X, and on some more exotic platforms.

    Strictly speaking, you should also pay attention to $Config{exe_ext} as well, sticking it on the end of $Config{perlpath} if it's not already there, but given that you're only on Unix you don't need to care about that.