Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Question on Recursionby ikegami (Patriarch) |
on Jan 09, 2009 at 11:06 UTC ( [id://735152]=note: print w/replies, xml ) | Need Help?? |
You're ignoring the result of the recursive call.
should be
Now, what we have here what is called tail-end recursion. The recursion is the last thing in the function. That means you can use a loop instead.
After some cleaning up, we get:
or even
Update: Added last snippet.
In Section
Seekers of Perl Wisdom
|
|