in reply to Re: Re: matching arrays
in thread matching arrays

This code is a simple version of the bit vector code:

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}++; }
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.

(++ to all the replies in this thread, because at this stage in the morning, I couldn't work out what the OP wanted at all ;) )