Updated Perl Script