Perl script cleaned up