in reply to Re: returning to a loop later on
in thread returning to a loop later on

redo FILENAME doesn't have a matching loop.
it doesn't have to be a loop, you can label blocks, too!
my $i = 0; FOO: { print "$i\n"; redo FOO unless ++$i > 4; }

Replies are listed 'Best First'.
Re^3: returning to a loop later on
by GrandFather (Saint) on Sep 07, 2006 at 03:46 UTC

    Indeed, but you can't redo to a label that is not in labling the current scope:

    FOO: { # scope 1 { # scope 2 redo FOO; # Ok } redo FOO; # Ok } { # scope 3 redo FOO; # Illegal }

    Prints:


    DWIM is Perl's answer to Gödel
      you can't do that with a loop, either, right? perhaps i am misunderstanding you, but that is not the situation with the OP's code, imperfect as it may be; the redo FILENAME is within the FILENAME: { }

        My appologies. OP's code, as you say, is not like that. I was confused by indentation issues :(.


        DWIM is Perl's answer to Gödel