my @keys = grep /^t/, keys %hash; my %newhash; @newhash{@keys} = @hash{@keys};