Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
The Deep recursion on subroutine ... is a warning, not an error. It may be an important symptom that something may be going wrong, but this in itself will not stop your program from continuing to run. This warning is displayed when you recurse more than 100 levels. Consider this one-liner implementation of the factorial function:
$ perl -wE 'say fact(102); sub fact {my $c = shift; return 1 if $c == +1; return $c *fact($c-1)}' Deep recursion on subroutine "main::fact" at -e line 1. 9.61446671503512e+161
We have the warning, but the program continued and printed the result.

But you can silence that warning if you know well enough what you are doing, using the no warnings "recursion"; pragma. For example:

$ perl -wE 'say fact(102); sub fact {my $c = shift; return 1 if $c == +1; no warnings "recursion"; return $c *fact($c-1)}' 9.61446671503512e+161
If your program stops working, it may be because your program recurses really too much, but you should presumably have another message, an actual error message (instead of a warning), telling you why it stopped (out of memory or something).




  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-24 08:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found