rsiedl has asked for the wisdom of the Perl Monks concerning the following question:
# an array of terms used to create hash1 my @terms = ( 'male','female','child' ); # hash1 of term arrays my %terms = (); $terms{1} = [ 'male' ]; $terms{2} = [ 'female' ]; $terms{3} = [ 'child' ]; $terms{4} = [ 'male', 'female' ]; $terms{5} = [ 'male', 'child' ]; $terms{6} = [ 'female', 'child' ]; $terms{7} = [ 'male', 'female', 'child' ]; # hash2 of term occurrences my %occurs = (); $occurs{111} = [ 'male' ]; $occurs{112} = [ 'male' ]; $occurs{113} = [ 'male', 'child' ]; $occurs{114} = [ 'female' ]; $occurs{115} = [ 'child', 'female' ];
my %tally = (); # Male on its own appeared twice $tally{hash1_terms1} = 2; # Female on its own appeared once $tally{hash1_terms2} = 1; # Child on its own appeared twice $tally{hash1_terms3} = 0; # and so on...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: matching arrays
by Enlil (Parson) on May 25, 2004 at 21:25 UTC | |
by rsiedl (Friar) on May 25, 2004 at 21:41 UTC | |
by rsiedl (Friar) on May 25, 2004 at 22:19 UTC | |
|
Re: matching arrays
by Fletch (Bishop) on May 25, 2004 at 21:12 UTC | |
by rsiedl (Friar) on May 25, 2004 at 21:31 UTC | |
by Jasper (Chaplain) on May 26, 2004 at 09:12 UTC | |
|
Re: matching arrays
by Plankton (Vicar) on May 25, 2004 at 21:09 UTC | |
by rsiedl (Friar) on May 25, 2004 at 21:27 UTC | |
by Plankton (Vicar) on May 25, 2004 at 21:40 UTC | |
|
Re: matching arrays
by BrowserUk (Patriarch) on May 25, 2004 at 21:17 UTC | |
by rsiedl (Friar) on May 25, 2004 at 21:30 UTC |