Programming Perl

Programming PerlSearch this book
Previous: 3.2.119 recvChapter 3
Functions
Next: 3.2.121 ref
 

3.2.120 redo

redo LABEL
redo

The redo command restarts a loop block without evaluating the conditional again. The continue block, if any, is not executed. If the LABEL is omitted, the command refers to the innermost enclosing loop. This command is normally used by programs that wish to deceive themselves about what was just input:

# A loop that joins lines continued with a backslash.
LINE: while (<STDIN>) {
    if (s/\\\n$// and $nextline = <STDIN>) {
        $_ .= $nextline;
        redo LINE;
    }
    print;  # or whatever...
}


Previous: 3.2.119 recvProgramming PerlNext: 3.2.121 ref
3.2.119 recvBook Index3.2.121 ref