Next | Program Repair Shop | 183 |
do_with_board(sub { if ($move eq "$_[0]$_[1]") { $squares->[$_[0]][$_[1]] = "x"; ## define array element for choice } });
This is a little cluttered
If we define do_with_board like this:
sub do_with_board(&) { ... }
We get a syntax that is like the grep and map operators:
do_with_board { if ($move eq "$_[0]$_[1]") { $squares->[$_[0]][$_[1]] = "x"; ## define array element for choice } };
Next | Copyright © 2002 M. J. Dominus |