Small microoptimization in Board::clone.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 20 Sep 2014 12:09:22 +0000 (14:09 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 20 Sep 2014 12:09:22 +0000 (14:09 +0200)
Board.pm

index ff2828a..3d83278 100644 (file)
--- a/Board.pm
+++ b/Board.pm
@@ -25,9 +25,7 @@ sub clone {
        my $nb = [];
 
        for my $row (0..7) {
-               for my $col (0..7) {
-                       $nb->[$row][$col] = $board->[$row][$col];
-               }
+               $nb->[$row] = [ @{$board->[$row]} ];
        }
 
        return bless $nb;