in reply to hangman question
2)can someone please explain to me in plain english what@guesses is in scalar context there, so it produces the number of elements in the array. That is used as an index to assign to an element of the array. Since the pre-assignment elements are numbered 0 through (@guesses - 1), it adds a new element to the end of the array.$guesses[@guesses]=$guess;
A much clearer way to write it would be:
push @guesses, $guess;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: hangman question
by Anno (Deacon) on Jul 16, 2007 at 11:13 UTC |