[Israel.pm] Understanding recursion [was What does this code do?]

Srikanth Madani srikanth.madani at vodafone.com
Mon May 3 02:07:27 PDT 2004

Shlomi, thanks for the illuminating reply.

>Now, when to use recursion? Most of the tail-recursion and linear-recursion 
>can be implemented as loops. Still, recursion is sometimes used to clearly 
>illustrate the algorithm, make the code clearer, or calculate the complexity 
>of the algorithm.

I don't see how recursion makes the code clearer. 
When I have to re-engineer code, or investigate a subtle-bug, one of the things I do is to examine data flow mentally or on paper.
This just doesn't work with recursion - my mind has a stack depth of three or four!

How does one start trying to understand undocumented recursive code?

Srikanth Madani
Senior Subject Matter Expert @ Amdocs Software GmbH

More information about the Perl mailing list