- or download this
my @arr;
while (my ($x, $y, $beans) = read_grid_cell) {
push @arr, [$x, $y, $beans];
}
# Or the equivalent map statement, if you like.
- or download this
my %hash;
while (my ($x, $y, $beans) = read_grid_cell) {
$hash{$x}{$y} = $beans;
}
- or download this
my @beans;
my %grid;
...
}
# Now you can walk through @beans, or you can lookup by $x and $y,
# but don't change the beans in either spot, because they're not linke
+d!