my %hash; while (my ($x, $y, $beans) = read_grid_cell) { $hash{$x}{$y} = $beans; }