Compile latest version of perl on Debian squeeze / Using latest version of perl on Debian squeeze

Debian squeeze comes with perl 5.10. For my tests with perl, I required 5.16.1, so I needed a newer version. Unfortunately only sid comes with newer perl versions.

Fortunately compiling from source is too easy.

Replace the perl source file name with the name of the file you download:

wget http://www.cpan.org/src/5.0/perl-5.16.3.tar.gz
tar -xf perl-5.16.3.tar.gz
cd perl-5.16.3/
sh Configure -d
make -j4
make install

Now, replace the system version with a symlink to your new version, unless you were smart enough to update the installation path with manual perl installation. when we used “Configure -d”, we used defaults for installation, so right now we have two versions of perl.

rm /usr/bin/perl
ln -s /usr/local/bin/perl /usr/bin/perl

Now install any optional modules:

cpan install WWW/Mechanize.pm
cpan install File/Find/Rule.pm

etc.