in reply to Re: Re: matching arrays
in thread matching arrays
So, if each occurrence can have each of 'male', 'female', etc. only once, the vector for each permutation is unique. Then get the vector for each possible occurrence, and see how many times each appeared in the %tally hash.my %bits = ('male' => 1, 'female' => 2, 'child' => 4); my %tally; foreach my $array_ref ( @occurances ) { my $vector = 0; $vector += $bits{$_} for @$array_ref; $tally{$vector}++; }
|
|---|