in reply to Shell script to Perl

Please use code tags for readabilty and post your code.