foreach my $key (keys %include) { if ($include{$key} eq 'yes') { $j++; } } print "$j records found\n"; #### $j++ ? ($include{$key} eq 'yes') : ''; print "$j records found\n";