Using a label without a loop and the redo statement : Redo « Statement « Perl






Using a label without a loop and the redo statement


#!//usr/bin/perl

ATTEMPT: {
   print "Yes/No? ";
   chomp($answer = <STDIN>);
   unless ($answer eq "yes"){
      redo ATTEMPT ;
   }
}

 








Related examples in the same category

1.Using the redo statement in a while structure.
2.redo statement
3.While loop, foreach loop, and block and redo
4.A word-counting program that uses the redo statement.