[oak perl] until loop(s)

Sandy Santra santranyc at yahoo.com
Mon Mar 28 12:13:17 PST 2005


I'm learning (struggling with) "until" loops today.  I want an "until" 
control structure that "breaks out" when a condition is fulfilled.

Can anyone find the problem in the below loop?  (It never breaks out.)  Thanks.

use strict;
print "Can you create world peace in five tries?  Type a solution below:\n";
my $number;
until (my $counter == 5)

{
         while ($number=<STDIN>)
         {
         $counter=$counter+1;
         print "Counter is now $counter.\n";
         print "You still have a few tries left.\n";
         }
}
print "You failed!  The human race is doomed!\n";





--Sandy Santra



More information about the Oakland mailing list