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
In reply to Re^4: How does 'goto LABEL' search for its label? (yow?)
by LanX
in thread How does 'goto LABEL' search for its label?
by moritz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |