in reply to Shorten scrip

In scalar context, grep returns the number of times its expression was true:
my $j = grep { $_ eq 'yes' } values %include; print "$j records found\n";
Your ternary operator was a little backwards. $j++ was getting evaluated every time, and then depending on its truth, either the comparison or the empty string was evaluated. The comparison should be the first part of the ternary operator. But if you want to do nothing if the condition fails, you shouldn't use a ternary, the following is much easier to read:
$j++ if $include{$_} eq 'yes';

blokhead