while ($answer <= 9) { if ($answer eq $numbers[$i]) { $answer = $words[$i]; $i++; $answer; } else { #print $answer; } # end if } # end while