There are some problems that are better suited to recursion and some that are better suited to looping. Some languages don't give you a choice (for example COBOL has no recursion, ML has no looping). Perl lets you choose. However, it should be noted that a non-recursive solution to a problem is usually at least marginally faster than a recursive solution. But when you convert a recursive algorithm to a non-recursive equivalent you normally end up writing a lot more code and making your program harder to read and support (i've seen 20 lines of recursive code become 200+ lines of non-recursive code). So unless you have a good reason to optimize out the recursion leave it in.
In reply to RE: Recursion
by lhoward
in thread Recursion
by lolindrath
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |