From bdd54b6a8f70d7feb5b9ed4c64d197a08a8c9057 Mon Sep 17 00:00:00 2001 From: Rob Emery Date: Mon, 9 May 2016 20:34:15 +0100 Subject: [PATCH] Conversions: now it's in a list of values; we can use List::Util again! --- lib/DDG/Goodie/Conversions.pm | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/DDG/Goodie/Conversions.pm b/lib/DDG/Goodie/Conversions.pm index a53d658aa..fe4dc215a 100755 --- a/lib/DDG/Goodie/Conversions.pm +++ b/lib/DDG/Goodie/Conversions.pm @@ -8,6 +8,7 @@ with 'DDG::GoodieRole::NumberStyler'; use Math::Round qw/nearest/; use utf8; use YAML::XS 'LoadFile'; +use List::Util qw(any); zci answer_type => 'conversions'; zci is_cached => 1; @@ -191,13 +192,7 @@ handle query_lc => sub { sub looks_plural { my ($input) = @_; - - my $is_plural = 0; - foreach my $x (values(%plurals)) { - $is_plural = 1 if(lc($x) eq lc($input)); - } - - return $is_plural; + return any {lc($_) eq lc($input)} values(%plurals); } sub convert_temperatures {