Perl solution to problem Reverse String