Help for this page

Select Code to Download


  1. 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.
    
  2. or download this
    my %hash;
    while (my ($x, $y, $beans) = read_grid_cell) {
        $hash{$x}{$y} = $beans;
    }
    
  3. 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!