in reply to Continuations in Perl - Returning to an arbitrary level up the call stack
out...my $i=0; target(); sub target { rec(); TARGET: print "END"; } sub rec { $i++; print "IN $i\n"; goto TARGET if ($i>5); # return skipping multiple levels rec(); # 6 levels recursive call print "OUT $i\n"; # never reached }
IN 1 IN 2 IN 3 IN 4 IN 5 IN 6 END
Cheers Rolf
( addicted to the Perl Programming Language)
added comments
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Continuations in Perl - Returning to an arbitrary level up the call stack
by unlinker (Monk) on May 18, 2013 at 20:50 UTC | |
by LanX (Saint) on May 18, 2013 at 20:56 UTC |