http://www.perlmonks.org?node_id=201048


in reply to Bad index while coercing array into hash

    for my $i (1..$POLYGONS_MAX_Y) {

- perl arrays start in "zero" by default. Try:

    for my $i (0..$POLYGONS_MAX_Y - 1) {