I have this memory of Perl limiting how deep subroutine recursion could go, but the following test suggests not:
perl -E 'sub f{say $_[0] unless $_[0] % 10000;exit if $_[0] > 30000;f( +$_[0]+1)};f(1)'

on perl 5.12 and 5.20, on windows and NetBSD, they both run (and without apparent limit, if you remove the "exit")

I got bit when debugging a recursive sub, and my perl process hard-froze my Windows 7 machine. The mouse moved but nothing else worked, not ctrl-alt-del, not "Fn-Sleep". I waited about 10 minutes, thinking it would run out of memory and exit, but the machine just stayed frozen :-(

Just curious if there was a recursion limit, and if so, when was it lifted?

Next day addendum - Thanks for all the replies! I've encountered the runtime warning, and the regexp recursion limit, and the debugger warnings all in the past, and I must have confabulated them. You all got ++ votes from me for your reminders.


In reply to No recursion depth limit? by Yary

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.