[Solved] perl: How to I count multiple values in hash into a new hash?


my %counts;
for (values(%hash)) {  # Iterate over the values of the hash, the references to the arrays.
   for (@$_) {         # Iterate over the values of the referenced array.
      ++$counts{$_};
   }
}

or

my %counts;
++$counts{$_} for map @$_, values %hash;

3

solved perl: How to I count multiple values in hash into a new hash?