Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I installed Perl 5.12 on my server, but when I try to check what version is running is says 5.10.

I had 5.10 installed previously, so how can I deactivate this older version and make 5.12 the default one? I'm running on Fedora.

share|improve this question
    
Check your PATH: echo $PATH –  larsmans Apr 19 '11 at 18:21
    
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/‌​usr/sbin:/usr/bin:/root/bin –  jack Apr 19 '11 at 18:23
    
Where did you put the new Perl? –  larsmans Apr 19 '11 at 18:24
    
here cd /usr/lib/perl-5.12.3 –  jack Apr 19 '11 at 18:27
    
That's not a very good place to install a program, but try /usr/lib/perl-5.12.3/bin/perl (and consider moving the installation to /usr/local or /opt). –  larsmans Apr 19 '11 at 18:33
add comment

migrated from stackoverflow.com Apr 19 '11 at 19:20

This question came from our site for professional and enthusiast programmers.

3 Answers

In general, you do not want to delete/uninstall the system perl. That's bad.

Instead, just add the path that the new perl is installed to to your PATH. Or symlink or hardlink that perl into a location in your PATH.

The problem is that your system is tested against a specific level of Perl. Tools that come with the distro you're on may not be updated to work with a newer level of perl. Further, if you have a binary distro (e.g., one based on debian or RPM, among others), you may install something from your distro that includes a perl module that includes XS (C code), and that debian/RPM/whatever will not necessarily work with the new version of Perl (crossing the 5.8/5.10 boundary was definitely a no-no).

So you should leave the system perl alone.

What I have done is: add ~/bin to my PATH, before /usr/bin, and then hardlink perl there to the desired Perl (I have more than one). Then I can run "perl tool" if I want to use my perl, or I can use "#!/home/myuser/bin/perl" as the first line to achieve the same idea. But, for system tools, which usually live in /usr/bin or /usr/sbin, they will have "#!/usr/bin/perl" as the first line, and be run by that perl.

Don't mess with your distro. You'll be on your own if anything goes wrong.

share|improve this answer
add comment

First, you need to check to see if your using the new version of perl or old (did you uninstall the old version before installing new version? To do this do:

 $ whereis perl
 perl: /usr/bin/perl /usr/share/man/man1/perl.1.gz

Then you need to check your install media to see where it installed the new version. if its not the same directory then you need to either update your path to search the directory where you installed the new version of perl before it checks the directory where the old version of perl or just uninstall the old version

share|improve this answer
    
ya .. it did give me what you said.. perl: /usr/bin/perl /usr/bin/perl5.10 /usr/share/man/man1/perl.1.gz how do i unistall it!.. –  jack Apr 19 '11 at 18:31
    
or how can i update the path to check for the new one!? –  jack Apr 19 '11 at 18:32
add comment

As noted, check your path. Run which(1) to see where it's finding the perl binary that's getting executed: which perl should do the trick.

And you don't need to uninstall the old version (although you might want to): some scripts you run might require the older version. You never know.

Make sure your perl scripts have a shebang as the first line (the command shell uses that to pick the interpreter for the script being executed). A shebang line for perl looks something like:

#!/path/to/desired/instance/of/perl -any -desired -perl -options -here

If your perl script's shebang looks like

#!/usr/bin/perl

you'll get the perl binary installed at that location.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.