use List::Pairwise qw(grepp); # grep hash subset my %subset1 = grepp {$a =~ /^ba/} %hash; my %subset2 = grepp {$b < 5} %hash;