Next Program Repair Shop 184

Higher-Order Functions

        do_with_board {
          if ($move eq "$x$y") {
             $squares->[$x][$y] = "x";   ## define array element for choice
          }
        };
        sub do_with_board (&) {
          local ($x, $y);
          my $code = shift;
          for $x (0..2) {
            for $y (0..2) {
              $code->();
            }
          }
        }


Next Copyright © 2002 M. J. Dominus