Ubuntu – How to use perl 5.12 in 10.10

10.10perl

How can I use perl 5.12 in Ubuntu? There is no distribution package on Ubuntu.

I have to use feature 'unicode_strings'; in my perl code, and this is available from 5.12.
I try to install perl on Ubuntu by apt-get install perl, but 5.10 is the latest version.

How can I deal with this? Or is there any code in 5.10 can replace the code feature 'unicode_strings';?

Thanks.

Best Answer

When writing your own applications, I recommend installing your own Perl. This was once a major pain, but no more. Nowadays, you can use perlbrew to build Perl for you.

On Ubuntu, I think you'll need the build-essential package first, if you don't already. After that, you can use the instructions on the perlbrew docs linked above to install it (or use cpan App::perlbrew).

Once installed you can run:

perlbrew init
perlbrew install perl-5.12.2
perlbrew switch perl-5.12.2

Once you do that and make sure Perlbrew's bashrc is loaded into your bashrc, you should be ale to run:

perl -v

and see that you're running 5.12.


The official perlbrew website is https://perlbrew.pl and it suggests installing by running

wget --no-check-certificate -O - http://install.perlbrew.pl | bash

Then you will still need to

perlbrew install perl-5.12.2
perlbrew switch perl-5.12.2

of course. Finally if you have multiple cores (and who doesn't these days) you can run

perlbrew install -j N perl-5.12.2

where N is the number of jobs requested, often the number of cores you have plus one. I use -j 5 on my quad-core and -j 3 on my dual-core netbook.

Related Question