for my $subhash (@hash{@keyset1}) { print $subhash->{$_} for @keyset2; }