While I'm sure most of us here would love to help, but without a more specific idea of what is going on, there isn't much help to offer except to point you to some resources such as:
perldebug.
However, if you could be more specific (perhaps psuedo-code) we could offer a little more insight.
-xylus