Solutions to task in Learning Perl