in reply to Debugging?

I'm on my way out so I will look at your code later. The first thing you want to know about is the perl debugger. It is activated by:
/usr/bin/perl -d <script name>
It has all the features of a standard debugger. Look at http://perldoc.perl.org/perldebtut.html. Good luck!