Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL redo Function
Syntax
Definition and Usage
Restarts the current loop without forcing the control statement to be evaluated. No further statements in the block are executed. A continue block, if present, will not be executed.
If LABEL is specified, execution restarts at the start of the loop identified by LABEL.
Return Value
Example
Try out following example:
#!/usr/bin/perl -w
$c = 1;
$d = 4;
LABEL:
{
$c++;
$e = 5;
redo LABEL if ($c < 3);
$f = 6;
last LABEL if ($e > 3);
$g = 7;
}
$h = 8;
print ("$c $d $e $f $g $h\n");
|
It will produce following results:
|

|
|
|