%hash_2= map { /regex/ ? ( $_ , $hash_1{$_} ) : () } keys %hash_1; #### my @keys = grep { /regex/ } keys %hash_1; @hash_2{@keys} = @hash_1{@keys};