http://www.perlmonks.org?node_id=833032


in reply to Re^2: cross scope gotos?
in thread cross scope gotos?

Maybe this code makes it clearer:

sub jump { print "in\n"; goto BACK }; sub jump2 {goto &jump } sub cont { for $i (0..1) { for $j ("a".."b") { print "$i,$j\t"; jump2(); # works #goto &jump; # fails BACK: } } } cont();

OUTPUT

0,a in 0,b in 1,a in 1,b in
in simple words:

It's not only possible to jump within the same scope, but also into the scope of previous ("outer") call frames.

(Pity I thought I found an easy pattern for continuations...)

Cheers Rolf