Thursday, October 20, 2022

Multidimensional array in perl

 

@comparisonAdjectives= (["good", "better", "best"],
                        ["bad", "worse", "worst"],
                        ["tall", "taller", "tallest"]);

for ($i = 0; $i < 3 ; $i++) {
    for ($j = 0; $j < 3; $j++) {
        print $comparisonAdjectives[$i][$j] . " ";
    }
    print "\n";
}

No comments:

Post a Comment