Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

find path to perl on windows

by Anonymous Monk
on Aug 05, 2005 at 08:59 UTC ( [id://481139]=perlquestion: print w/replies, xml ) Need Help??

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

hey, I use activestate perl 5.8 and i have two versions of it installed i think on the same computer.

one located in C:\Perl and the other located in D:\Perl.

I'm not sure why two of the same versions were installed, (im not the admin, but i have access). perhaps it could be because one version of it is 5.6 and the other is 5.8.

How can I tell what path my scripts are using for perl? Is there something on Windows where I can check environmental variables for perl?

thank you

Replies are listed 'Best First'.
Re: find path to perl on windows
by Corion (Patriarch) on Aug 05, 2005 at 09:04 UTC

    The easiest way to find out which Perl is being used is to ask Perl:

    perl -e "print $^X"

    This will tell you which Perl the OS finds first. You can also check $^X from within your Perl scripts and restart your script under a different Perl, but that is somewhat fragile.

Re: find path to perl on windows
by davorg (Chancellor) on Aug 05, 2005 at 09:05 UTC

    Look at the value in $^X. See perlvar for more details.

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Re: find path to perl on windows
by inman (Curate) on Aug 05, 2005 at 09:24 UTC
    The Perl executable that is executed by default will be determined by your system path (type path at the command prompt to see what it is). The path is searched in order to find executables etc. that are not specifically identified.

    If you need to change the version of Perl used then you (or the administrator) will need to change the path environment variable.

    perl.exe is also associated with the .pl file extension. You will want to verify that this association points to the correct version of perl. Save a perl script with the code mentioned previously (print $^X) and run it using the perl executable perl test.pl and by just entering the name of the file.

    Since you mention environment variables - there are a number that can be associated with Perl. Type 'set' to view the environment. Variables that start with perl may influence the behaviour of perl on your machine.

    Look at perlrun for more details.

Re: find path to perl on windows
by furry_marmot (Pilgrim) on Aug 05, 2005 at 16:13 UTC
    I had this problem with ActiveState Perl when I actually did install Perl in D:\Perl, and then later in C:\Perl. Their installer apparently doesn't clean up the registry when you uninstall. The upshot, if I remember correctly, was that it sometimes thought it was installed on C:, and sometimes on D:. Or, rather, the executable knew where it was, but the configuration was screwed up and sometimes modules or the PDK got installed in the wrong place if I wasn't paying attention.

    If you want to fix the problem permanently, first uninstall Perl and any add-on programs such as the PDK, then physically remove all Perl directories you can find. Then use regedit to track down and remove all references to ActiveState in the registry. After that, things should be normal.

    To see the path, type "path" in a command shell. To alter it, right-click on My Computer, then Environment Variables. Locate PATH in the lower window and edit it. Be careful with your semi-colons or you can mess up your configuration.

Re: find path to perl on windows
by esskar (Deacon) on Aug 05, 2005 at 09:18 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://481139]
Approved by marto
Front-paged by bofh_of_oz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-19 12:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found