in reply to Re^2: Length of array in hash of arrays
in thread Length of array in hash of arrays
That prints only the length of the first subarray, the one corresponding to the key "k". Let's do better and use the each keyword to print the length of each subarray.
my %g = (k => [8, 2, 10, 2, 1, 3],l => [10, 7, 9, 0, 1]); %gkey = sort keys %g; print 0+@{$g{each %gkey}}, "\n";
|
|---|