use strict;
use warnings;
our $limit =1050;
our $l=0;
sub tst {
$l++;
#warn "level: $l" unless $l%50;
die "LIMIT $limit reached" if $l>$limit;
tst();
}
tst();
####
D:\tmp\pm>perl -d tst_recursion.pl
Loading DB routines from perl5db.pl version 1.57
Editor support available.
Enter h or 'h h' for help, or 'perldoc perldebug' for more help.
main::(tst_recursion.pl:4): our $limit =1050;
DB<1> c
main::tst(tst_recursion.pl:9): $l++;
1000 levels deep in subroutine calls!
DB<1>
##
##
D:\tmp\pm>perl tst_recursion.pl
Deep recursion on subroutine "main::tst" at tst_recursion.pl line 12.
LIMIT 1050 reached at tst_recursion.pl line 11.
D:\tmp\pm>