Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

A mapping between perlvar and %Config ?

by szabgab (Priest)
on Aug 22, 2014 at 02:46 UTC ( [id://1098270] : perlquestion . print w/replies, xml ) Need Help??

szabgab has asked for the wisdom of the Perl Monks concerning the following question:

In perlvar it is explained that $^O is identical to $Config{'osname'} but I am not sure if $^X is identical to $Config{perlpath} or not. I could not find this information in Config either.

Is there a table mapping all of these variables to each other?

Replies are listed 'Best First'.
Re: A mapping between perlvar and %Config ? ( $^O $Config{osname} $^X $Config{perlpath} )
by Anonymous Monk on Aug 22, 2014 at 03:18 UTC

    but I am not sure if $^X is identical to $Config{perlpath} or not.

    Why not? perlvar has a couple of pages explaining what $^X means, the dangers of relying on $^X...

    Config is the docs you want :) osname, perlpath

    Basically, $^X is the name of the actual exe, wherever it lives, whatever it has been renamed to (notperl.exe)

    except on VMS. perlvar warns about $^X not containing .exe suffix on VMS ... easier to document than fix VMS bugs I guess (weak sauce)

    I use $^X all the time, I've never seen VMS :)

      I am using Perl on VMS quite regularly (perhaps an average 4 or 5 days per month. I would guess it has to do with the fact that you usually don't call exe files directly by their name on VMS, but almost always through a symbol (something similar to an environment variable) pointing to the exe file. Quite probably, $^X knows the symbol name, but not the exe file behind. I'll try to test this when I get to work.

      Update: Actually, I just tried, on our VMS platforms, with Perl version 5.8.6, $^X contains the full name, including physical path, exe extension and even the version number:

      ROL>sh symbol perl PERL == "$PERL_ROOT:[000000]PERL.EXE" ROL>sh logical PERL_ROOT "PERL_ROOT" = "$1$DGA3501:[SYS0.SYSCOMMON.PERL5_8_6.]" (LNM$JOB_834 +94F40) ROL>perl -e "print $^X, qq(\n)" $1$dga3501:[sys0.syscommon.perl5_8_6.][000000]perl.exe;1

        Ahh, fond memories. Actually miss that OS (15+20 years past). Lots of interesting features.