First, I agree with what has been said by merlyn and the majority of the other posters: in general, your question can't be answered, since it is meaningless without mentioning a concrete problem.

This said, one could argue that Perl is not as well suited to recursive solutions as some other languages are, since it's function call implementation places a comparatively large load on the system in terms of memory and execution speed. Perl is simply not optimized for recursion, but for other operations (e.g., text manipulation and file IO).

For some more exact data on this, have a look at Timing Trials, or, the Trials of Timing: Experiments with Scripting and User-Interface Languages, a research paper that compares the performance of C, Awk, Perl, Tcl, Java, Visual Basic, Limbo and Scheme on different platforms for loops and arithmetic, function calls (using the heavily recursive Ackermann function), arrays and strings, associative data structures, input/output, graphical user interfaces, and compilation vs. interpretation.

Christian Lemburg
Brainbench MVP for Perl
http://www.brainbench.com


In reply to RE: Recursion by clemburg
in thread Recursion by lolindrath

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.