Tutorials Point


  Perl Home

  PERL Functions

© 2011 TutorialsPoint.COM


  Home     References     About TP     Advertising  

PERL redo Function



Syntax

redo LABEL

redo


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

  • Nothing

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:

3 4 5 6  8


Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names