in reply to Problem with traversing a two dimensional array
If you want to read your whole file into an array anyway, you can use <FILE> in list context to get the whole file in one go. Use map to translate each line into the desired array reference.
my @sandGrid = map { chomp; [ split '', $_ ] } <FILE>;
In the end it does the same thing as a loop but in a more compact way. Whether this suits your style you need to decide yourself.
Either way, it is always useful to use Data::Dumper to inspect what you've got:
use Data::Dumper; ... print Dumper \@sandGrid;
|
|---|