Solution in Perl for http://projecteuler.net.