Add a Perl solution to problem 4