#!/usr/bin/env perl use warnings; use strict; my %HoH = ( flintstones => { lead => "fred", pal => "barney", }, jetsons => { lead => "george", wife => "jane", kid => "jane", }, simpsons => { lead => "homer", wife => "marge", kid => "bart", }, ); my $total_jane_count = 0; for my $group ("simpsons" ,"jetsons" ) { my %family_hash = %{ $HoH{$group} }; for my $name (values %family_hash) { if ($name eq 'jane') { $total_jane_count++ } } } print "total_jane_count = $total_jane_count\n"; #### total_jane_count = 2