in reply to Recursion Woes

There have been times where I thought of interesting solutions to a problem by using executable code within regular expressions. The problem is that as soon as I start doing something "real" I find mysterious crashes, which I've never been able to reproduce with simple test cases. My conclusion was that, for the time being, it's better to stay away from fancy experimental features in regexes and just write more code (such as a state machine) outside the regex.

As an alternative, you can consider using a parser generator such as Parse::RecDescent or Parse::Yapp.