my @wants = grep { something } keys %haystack; print Dumper{@haystack{@wants}};