##
my %hash;
while (my ($x, $y, $beans) = read_grid_cell) {
$hash{$x}{$y} = $beans;
}
####
my @beans;
my %grid;
while (my ($x, $y, $beans) = read_grid_cell) {
push @beans, [$x, $y, $beans];
$grid{$x}{$y} = $beans;
}
# 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 linked!