| Next | Program
Repair Shop ![]() |
182 |
Then, for example, instead of this:
170 foreach $x(0..2) {
171 foreach $y(0..2) { ##test for each square
172 if ($move eq "$x$y") {
173 $squares->[$x][$y] = "x"; ## define array element for choice
174 }
175 }
176 }
Use this:
do_with_board(sub {
if ($move eq "$_[0]$_[1]") {
$squares->[$_[0]][$_[1]] = "x"; ## define array element for choice
}
});
| Next | ![]() |
Copyright © 2002 M. J. Dominus |