http://www.perlmonks.org?node_id=601938


in reply to Hash assignments using map

In addition to what others have said, you could do:
my @to_keep = (...); my %keepers; @keepers{@to_keep} = ();
which you would then test with exists $keepers{$x}. Althought I'm curious why you need the %keepers hash if you have the @to_keep array.

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart