my %new_hash = map { $_ => $original_hash{$_} } grep {/foo/} keys %original_hash;