|Problems? Is your data what you think it is?|
</code>The easiest way to reverse engineer a perl program is:
Seriously, if the code baffles you that much, you should use the perl debugger. There's a node discussing its usage here.
Also make sure that you are using the -w switch and that you are using strict. If the code is this sloppy, then there's bound to be errors in it, and these options will help you debug the errors more quickly.
Text highlighting and indentation make code more understandable. Use an editor like Xemacs or VIM to reformat the code into more readable pieces. Both of these editors are available for all *nix and Win32 systems.
And if there's C/C++/XS stuff involved, check out strace(1), which exists for most *nix systems, as well as NT.
Disclaimer: This post may contain inaccurate information, be habit forming, cause atomic warfare between peaceful countries, speed up male pattern baldness, interfere with your cable reception, exile you from certain third world countries, ruin your marriage, and generally spoil your day. No batteries included, no strings attached, your mileage may vary.