cancel
Showing results for 
Search instead for 
Did you mean: 

PERL Installation

 
Highlighted
Occasional Contributor

PERL Installation

I have installed Perl5.9.4 in unix box.
but there was already a lower version of perl present(Perl5.005_03).
The old version is present in usr/bin/perl
and the newer version is installed in usr/local/bin/perl.
when i gave 'which perl' command then it gave the path of the older version.
when i gave 'perl -v' it gave the older version.
what should i do for the newer version to be used?
9 REPLIES 9
Highlighted
Honored Contributor

Re: PERL Installation

What platform are you on?
One long-haired git at your service...
Highlighted
Acclaimed Contributor

Re: PERL Installation

Hi Praveen:

Did you logout and back in after the installation? 'which' is not sensitive to path changes that occur during a session.

Regards!

...JRF...
Highlighted
Honored Contributor

Re: PERL Installation

edit your .bash_profile file, locate the line that begins with PATH=
and make sure it looks like the following:
PATH=/usr/local/bin/:$PATH
Highlighted
Occasional Contributor

Re: PERL Installation

i have given the path for the new installation in the bash .profile
the older version of the perl, the name is perl. for the newly installed one the name is perl5.9.4. so when i give which perl command then its showing the older path and when i give which perl5.9.4 then its showing the newer path.
how can i make sure that when i try to execute a perl program the newer version will take it up?
Highlighted
Honored Contributor

Re: PERL Installation

1. type `echo $PATH` and post the output.

2. Create a soft link from perl5.9.4 to perl in the same directory (/usr/local/bin isn't it).
Highlighted
Occasional Contributor

Re: PERL Installation

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/osmf/mgmt/ssh/bin

this is the output i got when i gave echo $PATH
Highlighted
Honored Contributor

Re: PERL Installation

/usr/local/bin must precede /usr/bin in PATH= declaration. You have to change the line in your initialization script accordingly.
Highlighted
Honored Contributor

Re: PERL Installation

.. Which once again brings me back to asking what platform you are on ..

For it to be installed in '/usr/bin/', you had some pre-packaged version of Perl. Given that it was 5.005_03 (i.e. 10 or so years old).

Coupled with that, you've installed a development release of Perl? If this is a production server, what was that thought process?

In any case, to do this all properly, your best practice would be to rename the old perl binaries in '/usr/bin'. RENAME.. Not remove. This way you can always go back if you need too.

A list will look something like this:

/usr/bin/a2p
/usr/bin/c2ph
/usr/bin/cpan
/usr/bin/dprofpp
/usr/bin/enc2xs
/usr/bin/find2perl
/usr/bin/h2ph
/usr/bin/h2xs
/usr/bin/instmodsh
/usr/bin/libnetcfg
/usr/bin/perl
/usr/bin/perl5.8.3
/usr/bin/perlbug
/usr/bin/perlcc
/usr/bin/perldoc
/usr/bin/perlivp
/usr/bin/piconv
/usr/bin/pl2pm
/usr/bin/pod2html
/usr/bin/pod2latex
/usr/bin/pod2man
/usr/bin/pod2text
/usr/bin/pod2usage
/usr/bin/podchecker
/usr/bin/podselect
/usr/bin/prove
/usr/bin/psed
/usr/bin/pstruct
/usr/bin/s2p
/usr/bin/splain
/usr/bin/xsubpp

This is from a much newer release (5.8.4), so some of thsoe won't exist.

From there, soft-link the new binaries from '/usr/local/bin' into '/usr/bin'.

This way, you won't muck up your path order (of which for security reasons you probably don't want to do), and will also retain old '.pl' scripts which are #!'d to '/usr/bin/perl'.

If you've only installed this version of perl as a 'test', then you should just directly reference it in all of your tests.
One long-haired git at your service...
Highlighted
Honored Contributor

Re: PERL Installation

Oh, and what I've not mentioned yet is that a lot of your old CPAN modules may need to be udpated as well, as they might rely upon old concepts that no longer work with newer versions of perl.

You may be lucky, and they'll just work, but...

/usr/local/bin/perl -MCPAN -eshell

This is your friend *nod*.
One long-haired git at your service...