Algorithms in Perl