summaryrefslogtreecommitdiffstats
path: root/lib/smartmatch/engine/core.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/smartmatch/engine/core.pm')
-rw-r--r--lib/smartmatch/engine/core.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/smartmatch/engine/core.pm b/lib/smartmatch/engine/core.pm
index 27a5c92..a3c96b9 100644
--- a/lib/smartmatch/engine/core.pm
+++ b/lib/smartmatch/engine/core.pm
@@ -72,7 +72,13 @@ sub match {
}
elsif (type($b) eq 'Hash') {
if (type($a) eq 'Hash') {
- return match([sort keys %$a], [sort keys %$b]);
+ my @a = sort keys %$a;
+ my @b = sort keys %$b;
+ return unless @a == @b;
+ for my $i (0..$#a) {
+ return unless $a[$i] eq $b[$i];
+ }
+ return 1;
}
elsif (type($a) eq 'Array') {
return grep { exists $b->{$_ // ''} } @$a;