No. $i gets assigned 0, 1 and 2 - indexes into the two arrays, not the contents of the elements of @letters. 0 .. $#letters is the list context range operator and generates a list containing the integers from 0 to the index of the last element in @letters (0, 1 and 2 for this example).
The code depends on elements of @blankwords being set to 0 until they are assigned a correct letter. The test could be rewritten if ($blankword[$n] eq $letters[$i]) { to make an explicit check that the correct letter has been guessed.
In reply to Re^3: hangman question
by GrandFather
in thread hangman question
by convenientstore
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |