in reply to Please debug this code
Please eliminate aspects which are not relevant to your question. There's no reason for you to need more than 10 lines of data to demonstrate your problem.
While I didn't look into your problem, I couldn't help but notice two issues when I scrolled down.
First, you seem to be running without warnings or else you'd get at least one:
>perl -c -we"sub recur($) { recur('x') }" main::recur() called too early to check prototype at -e line 1. -e syntax OK
Granted, it's harmless since you shouldn't be using prototype there anyway, but who knows what else you are missing. Use use strict; use warnings;!
Secondly, I spot instances of if (/.../g). What do you think that means? "If it matches, check if it matches again to make sure!"? Aside from not making any sense conceptually to use /g like this, it can be the cause of problems. (if (/.../gc) has uses, but that's not what we have here.)
So start by fixing the strictures, the warnings and the if (/.../g) constructs, then give us a manageable demonstration of your problem if it still exists.
|
|---|