From 139f5e738a9546ae8b6a460da7bf0c473ff55296 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 7 Jul 2011 02:58:31 -0500 Subject: undef should check the '' hash key --- lib/smartmatch/engine/core.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/smartmatch/engine/core.pm b/lib/smartmatch/engine/core.pm index c7be71f..00955d4 100644 --- a/lib/smartmatch/engine/core.pm +++ b/lib/smartmatch/engine/core.pm @@ -75,7 +75,7 @@ sub match { return match([sort keys %$a], [sort keys %$b]); } elsif (type($a) eq 'Array') { - return grep { defined && exists $b->{$_} } @$a; + return grep { exists $b->{$_ // ''} } @$a; } elsif (type($a) eq 'Regex') { return grep /$a/, keys %$b; @@ -89,7 +89,7 @@ sub match { } elsif (type($b) eq 'Array') { if (type($a) eq 'Hash') { - return grep { defined && exists $a->{$_} } @$b; + return grep { exists $a->{$_ // ''} } @$b; } elsif (type($a) eq 'Array') { return unless @$a == @$b; -- cgit v1.2.3