in reply to sub calls and memory use
The call stack grows.
Perl does not implement "tail call optimization" automatically.
If you want this, you need to do it manually, by using goto:
$|++; re(); sub re { print '.'; select undef,undef,undef,0.01; goto &re; }
or
use 5.016; $|++; re(); sub re { print '.'; select undef,undef,undef,0.01; goto __SUB__; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: sub calls and memory use
by LanX (Saint) on Nov 16, 2019 at 12:38 UTC | |
|
Re^2: sub calls and memory use
by Anonymous Monk on Nov 16, 2019 at 14:06 UTC | |
by Corion (Patriarch) on Nov 16, 2019 at 14:17 UTC | |
by LanX (Saint) on Nov 16, 2019 at 14:55 UTC | |
by dave_the_m (Monsignor) on Nov 16, 2019 at 15:30 UTC | |
by Anonymous Monk on Nov 16, 2019 at 14:43 UTC | |
by LanX (Saint) on Nov 16, 2019 at 15:03 UTC | |
by Anonymous Monk on Nov 16, 2019 at 15:35 UTC |