I'd try to comment huge parts of the code out, until Perl stops complaining. The remaining code need not make sense, you only have to make sure it contains no syntax errors. (update: use perl -c for this!) Then re-add the code step by step so you can find the source of the trouble.