in reply to Number guessing game
To keep a record of all the (valid) guesses made, use an array:
my @guesses; GUESS: ...
Then, once a guess has been validated, push it onto the array:
push @guesses, $guess;
When you want to print all the guesses made so far, you can say:
print join(', ', sort { $a <=> $b } @guesses), "\n";
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Number guessing game
by Anonymous Monk on Nov 26, 2014 at 02:24 UTC |