in reply to Re: A useful use of goto
in thread A useful use of goto

> The code is inside a loop (yes it is) so there is no need to use goto:

Are you sure? IMHO each redo means leaving the scope and "delocalizes" all variables so far.

perl -e ' NEXT: { local $a.=$x++; redo NEXT if $x<10; print $a; # prints only 9 } '
BTW: no need for a NEXT label, redo alone would do! : )

UPDATE: I think you're wrong!

$x=0; { NEXT: { $x==0 ? (local $a="A") : (local $b="B"); redo NEXT if $x++<1; print $a,$b; } }
only prints "B"! BUT
$x=0; { NEXT: $x==0 ? (local $a="A") : (local $b="B"); goto NEXT if $x++<1; print $a,$b; }
prints "AB"