[oak perl] until loop(s)

Sandy Santra santranyc at yahoo.com
Mon Mar 28 13:03:56 PST 2005


At 12:48 PM 3/28/05 -0800, you wrote:

>Did you "use warnings"?  It would tell you:
>
>   Use of uninitialized value in numeric eq (==) at foo line 4.

OK.  No, I don't know how to solve that; I still get that error.  But 
thanks to your logic, David, I got the script to work (by taking out the 
While loop):

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

         {
         $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