love2code love2code - 3 months ago 23
Perl Question

How to set correct perl path

I have 2 versions of perl installed. perl v5.18.2 and v5.20.0 . But when I do

perl -v
I get perl v5.18.2. I don't need v5.18.2 at all. I need v5.20.0. How do I change the path to include v5.20.0 and not v5.18.2?

Here is my
$PATH
:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games


v5.18.2 is installed at
/usr/bin/perl
and
/usr/bin/perl5.18.2
, and v5.20.0 at
/root/perl5/perlbrew/perls/perl-5.20.0/bin/perl
.

Answer

See the perlbrew documentation:

switch Permanently use the specified perl as default

perlbrew switch perl-5.20.0

If you haven't already, you will need to add source /root/perl5/perlbrew/etc/bashrc to your login script for this to work.