Using nested for loop to output the elements in a two-dimensional array
@array = (
["A", "F"],
["B", "E", "G"],
["C", "D"],
);
for $outer (0..$#array) {
for $inner (0..$#{$array[$outer]}) {
print $array[$outer][$inner], " ";
}
print "\n";
}
Related examples in the same category