Don't ask to ask, just ask | |
PerlMonks |
Re: Misunderstanding Recursionby samtregar (Abbot) |
on Dec 15, 2006 at 22:53 UTC ( [id://590144]=note: print w/replies, xml ) | Need Help?? |
As you've discovered, recursion isn't very time or space efficient, compared to iteration. However, don't toss it out of your toolbox completely - it's very useful dealing with bounded data-structures where you know in advance the maximum depth. I use recursion all the time when dealing with small trees (XML parse trees, category hierarchies, etc.).
The intimate relationship between recursion and iteration is a major theme in Higher Order Perl. Pick up a copy and blow your mind today! -sam
In Section
Seekers of Perl Wisdom
|
|