I have a few perls compiled and installed in
$ ls
/opt/perl
5.10.0 5.6.2 5.8.7 5.8.8
A long time ago, I tried to set up an environment that would setup the proper PATH to always reach the perl I wanted when typing perl on the command-line. That involved a shell script, which of course couldn't change the environment of the outer shell, so it actually started another shell, resulting in the following mess:
5271 pts/2 Ss 0:01 bash
6182 pts/2 S 0:00 \_/bin/bash ./perlenv 5.10.0
6183 pts/2 S 0:00 \_/bin/bash
I could also have moved a canonical symlink around, but this had the advantage that several independent shells could run different perls.
Anyway, that was unworkable until I realized I could change the current
shell environment using aliases or shell functions.
So, assuming my perl binaries live in
setperl ()
{
export PATH=`echo $PATH|sed -e "s:/opt/perl/[^/]*/bin:/opt/perl/$1/bin:"`
}
And my ~/.bashrc points to the perl I want to use by default.
Switching perls 0 Comments More | Login | Reply /