# declare $grid to hold ref to anon hashes (thanks tye) my $grid; for my $x(-5..5) { for my $y(-5..5) { $grid->{$x}{$y} = "co-ords x:$x, y:$y"; } } print "Here is -2,3 : ", $grid->{-2}{3}; print "\nHere is 0,0 : ", $grid->{0}{0};