Reputation: 8806
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
.
Upvotes: 3
Views: 13731
Reputation: 385764
The following will add the desired build of Perl to the search path so that it's found first:
export PATH="/root/perl5/perlbrew/perls/perl-5.20.0/bin:$PATH"
You may add that to your login script to make this change permanent.
Note that you'll need to update the shebang (#!
) lines of scripts installed with a different perl
to the following:
#!/root/perl5/perlbrew/perls/perl-5.20.0/bin/perl
Upvotes: 1
Reputation: 943556
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.
Upvotes: 5
Reputation: 126722
It looks like you have three copies of perl installed, as neither of the paths you mentioned are in the PATH variable yet your shell still finds one
There's no need for perlbrew. All you need to do is set your PATH variable on the command line
$ export PATH=/usr/bin/perl5.18.2:$PATH
If you want to make that change permanent then add the command to your profile file at ~/.profile
Upvotes: 0