I am about to attempt my first recursive application. While researching it there seems to be some caveats with respect to recursion in perl. Does anyone have any general advice about common gotchas with perl recursion? TIA.
I quite like recursive applications, and I seem to remember rharsh posted an absolute corker a while back (but I can't seem to find it).
The biggest gotcha is making sure that the 'stop condition' that eventually terminates the recursion is pretty much bulletproof - otherwise you just loop until you run out of memory.
Not all applications are right for recursion. What do you want to do - we might be able to advise on the suitability of a recursive solution...
Steve
[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object:erlDesignPatterns)[/small]
Thanks for the reply. I'm not too worried about the termination condition. I've written plenty of recursive applications (mostly C) but never with perl. I'm writing an HTML to GED conversion application. Since I want it to go up and down the branches, recursion seems the easiest way to go.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.