my %hash = do 'data.pl'; my $item = "Perl"; my $out = grep {-p $_->{$item}} values %hash ? 1 : 0;