in reply to Re: Counting Data in two columns?
in thread Counting Data in two columns?

Thank You, everyone for your help! I am just confused with the following example. I think it is an inverted form of the original example I performed:
%HoA = ( flintstones => [ "fred", "barney" ], jetsons => [ "fred", "jane", "elroy" ], simpsons => [ "fred", "marge", "bart" ], );
If the family names (jetsons, simpsons) are always different but elements within each of the familes may or may not match. If I want to show that:
"fred" is a name that can be found in 3 families = [flintstones, jetso +ns, simpsons] e.t.c
Is this possible with this hash formation?

Replies are listed 'Best First'.
Re^3: Counting Data in two columns?
by neniro (Priest) on Jun 15, 2006 at 14:00 UTC
    #!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %hoa = ( flintstones => [ "fred", "barney" ], jetsons => [ "fred", "jane", "elroy" ], simpsons => [ "homer", "marge", "bart" ], ); my @freds = grep { $hoa{$_}->[0] eq 'fred' } sort keys %hoa; print Dumper \@freds;
      Thank You. But is grep an unix command? Unfortunately, I do not use Unix?