Hash-Util-Pick reviews

cpanratings
 

RSS | Module Info | Add a review of Hash-Util-Pick

Hash-Util-Pick (0.03)

One can easily use this idiom instead:

$picked = { map {(exists $hash{$_} ? ($_=>$hash{$_}):())} @keys };

or:

$picked = { map {$_=>$hash{$_}} grep {exists $hash{$_}} @keys };

or (if you want non-existing picked keys to be created instead):

$picked = { map {$_ => $hash{$_}} @keys };

but Hash::Util::Pick is implemented in XS and can be a few times faster than the above when the number of keys has reached thousands. So I guess this module has its uses.