Hash-Search reviews


RSS | Module Info | Add a review of Hash-Search

Hash-Search (0.03)

my %fruits = qw(one orange two banana three apple four pear five pineapple);
my %results = map { $_ => $fruits{$_} } grep { /e$/ } keys %fruits;
my $count = keys %results;

This is all the module does, but with no discernable advantage over doing it with just the built-ins. The method names repeat the class type unnecessarily and therefore are longer to type than need be. The documentation specifies that the first parameter to hash_search is a regular expression, but the examples show a string type scalar instead. Since there is no type check for this parameter and it is simply interpolated by the m operator, this only works by coincidence.

daxim - 2010-02-10T10:00:39 (permalink)

1 out of 1 found this review helpful. Was this review helpful to you?  Yes No