sub reverseArray { my @arr = @_; for my $i (0 .. $#arr) { @{ $arr[$i] } = reverse @{ $arr[$i] }; } }