in reply to Re^2: Control Structure problem, mistake can't be found
in thread Control Structure problem, mistake can't be found
And, for goodness' sake, use warnings;. This would have shown you that you incremented past the end of your @correct array (the first index of an array in perl is 0, not 1). I added these print statements to show the problem:
print "guess=$guess=\n"; print "correct[$i]=$correct[$i]=\n"; if ($guess eq $correct[$i]) { # if guess is correct, reply print "You Rock!\n"; $i++;
|
|---|