rob171171 has asked for the wisdom of the Perl Monks concerning the following question:

Hi I have successfully downloaded Perl 5.12.3 from perl.org to my home dir on my Linux machine. I have carrie dout the following steps as per README file
./Configure -des -Dprefix=$home/localperl make make test make install
However I still see to be running the old Perl 5.8.8 version as outputted from perl -v. How do I 'activate' Perl 5.12.3 now? As you may guess I am new to Perl and such work so if you can bear this in mind when responding I would be very much appreciative.Regards

Replies are listed 'Best First'.
Re: installing perl 5.12.3
by moritz (Cardinal) on Apr 21, 2011 at 08:58 UTC
    However I still see to be running the old Perl 5.8.8 version as outputted from perl -v. How do I 'activate' Perl 5.12.3 now?

    You have to add $home/localperl/bin to your PATH environment variable before the path in which your current Perl is.

    On this occasion I can recommend App::perlbrew, which makes it very easy to install custom perl versions and switch between them and the system perl.

      Unfortunately perlbrew is not recognised either

      I have also amended my PATH but perl -v still shows 5.8.8!!

        Make sure that the new perl comes before the old one in the path. Also, your shell may have cached the location of perl and so not "see" the old one even though the $PATH has changed.

        You can clear that cache with the hash command in bash, and you can see which perl executable comes first in the path with which perl.

Re: installing perl 5.12.3
by John M. Dlugosz (Monsignor) on Apr 21, 2011 at 08:56 UTC
    What operating system are you running?

    You probably have both versions installed. The one installed using the OS's package manager is the one aliased to "perl" without qualification.

    You should be able to run the desired version using a qualified name: try perl5.12.3 -v.

    You might have it on a different path than the OS's installed version, too.

      Linux 2.6.24.5-85.fc8 my PATH is
      PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/b +in:/usr/bin:/bin:/usr/X11R6/bin:/home/pats/bin
      command not found results from perl5.12.3 -v.
Re: installing perl 5.12.3
by Anonymous Monk on Apr 21, 2011 at 09:44 UTC
    Run this program and add the output to your .bashrc or .bash_profile or autoexec.bat
    #!/usr/bin/perl -- use strict; use warnings; use Config; Main( @ARGV ); exit( 0 ); sub Main { my $sep = $Config{path_sep}; my $pat = 'export PATH=%s$PATH'; $pat = 'set PATH=%s%%PATH%%' if $sep eq ';' ; printf "$pat\n", join $sep, ( uniq( grep length, grep defined, map { $Config{$_} } qw' installsitebin installvendorbin installbin ' ), ), ''; } sub uniq (@) { my %seen = (); grep { not $seen{$_}++ } @_; } __END__
    The output looks like
    export PATH=/usr/bin:$PATH
    or
    set PATH=c:\perl\5.12.2\bin\MSWin32-x86-multi-thread;c:\perl\site\5.12 +.2\bin;c:\perl\5.12.2\bin;%PATH%

      which bashrc should I edit?

      [root@Gandalf bin]# find / -name bashrc /root/perl5/perlbrew/etc/bashrc /etc/bashrc /usr/share/doc/bash-3.2/startup-files/bashrc
        The one in your home directory, i've seen .profile, .inputrc, .bashrc ...
      Bah, that should be
      #!/usr/bin/perl -- use strict; use warnings; use Config; Main( @ARGV ); exit( 0 ); sub Main { my $sep = $Config{path_sep}; my $pat = 'export PATH=%s$PATH'; $pat = 'set PATH=%s%%PATH%%' if $sep eq ';' ; printf "$pat\n", join $sep, ( uniq( grep length, grep defined, map { $Config{$_} } qw' installsitebin installvendorbin installbin installsitescript installvendorscript installscript ' ), ), ''; } sub uniq (@) { my %seen = (); grep { not $seen{$_}++ } @_; } __END__

        the output od the latest code is

        export PATH=/usr/bin:$PATH

        I have added this line to both /root/perl5/perlbrew/ and etc/bashrc

        however im still seeing Perl 5.8.8