grep { nth_element_of_the_key eq 'test' } keys %hash;