in reply to Re^3: How does 'goto LABEL' search for its label? (yow?)
in thread How does 'goto LABEL' search for its label?
It's a way to directly break out of a deep recursion.
my $counter; sub rec { goto OUT if $counter++ >= 10; print $counter; rec(); # never reached } rec(); OUT:
This can be handy to avoid the code-block after a recursive call w/o needing to check a status-flag.
Cheers Rolf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: How does 'goto LABEL' search for its label? (yow!)
by tye (Sage) on Jan 17, 2013 at 04:07 UTC | |
by LanX (Saint) on Jan 17, 2013 at 04:11 UTC |