Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I had perl version 5.8.8 installed in my system. I have installed 5.10.0 at /usr/local/bin/perl. but when i restarted my linux box now the default perl path has been changed.

which perl
/usr/local/bin/perl

I want to use perl version 5.10.0 but also want to keep default path to /usr/bin/perl (version 5.8.8).

I have tried to make an alias in my bash profile but after doing this I am not able to use perl 5.10. Can you please suggest me the way to fix this issue.

share|improve this question
add comment

4 Answers

up vote 5 down vote accepted

Check your $PATH and make sure that /usr/local/bin comes after /usr/bin

echo $PATH
share|improve this answer
add comment

You need to learn about the PATH environment variable. Do in a terminal:

   echo $PATH

You'll see the different directories where binaries are looked for. Usually, you'll have /usr/local/bin before /usr/bin. You can modify the PATH variable in your ~/.profile or ~/.bash_profile.

Yours, david

share|improve this answer
add comment

simply declare:
use 5.10.0;

have a look in "Location of Perl" chapter in perlrun

share|improve this answer
    
This only enables new features such as 'say "bla";' in perl. It does not do anything with regards to what perl you use. –  MichielB Aug 31 '11 at 19:30
add comment

In general, using a different perl on your linux box than the system perl can be really messy, especially if you want to use multiple modules. This is because all the modules that have C code require compilation and will be dependent on your perl version. For instance if you use DBD::mysql the 5.8 version does not work for 5.10.

The 'modern' answer to this nowadays is to use perlbrew and install a different perl in your home directory, you can even have multiple.

Then you can use cpanminus to install the modules you need. You'd have installed the devel modules for mysql in order to be able to compile the module, but it will work neatly and will not break the rest of your system. https://metacpan.org/module/App::cpanminus#Installing-to-local-perl-perlbrew-

share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.