In addition to the advice you have already been given, check out How do I convert a VBA macro to Perl? which should give you a few pointers, failing that a super search may provide further help. If you are still having problem (after reading the article I link to and trying that approach) feel free to post the code you are having problems with.