From: Rafael Garcia-Suarez Date: Mon, 23 Mar 2009 15:55:52 +0000 (+0100) Subject: Revert order of ~~ in definition of smart matching against arrays X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b38a9f03ccfb6bed7372d1c19957d641d2b57699;p=p5sagit%2Fp5-mst-13.2.git Revert order of ~~ in definition of smart matching against arrays This allows to remove a special case (Hash ~~ Array). We're also going to reuse ~~ in the Array ~~ Hash smart match definition. More tests will be needed. --- diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod index 157b02b..5b1af05 100644 --- a/pod/perlsyn.pod +++ b/pod/perlsyn.pod @@ -688,15 +688,14 @@ entries apply in those cases. Any CodeRef scalar sub truth $b->($a) Hash Hash hash keys identical [sort keys %$a]~~[sort keys %$b] - Array Hash hash slice existence[1] @$a == grep {exists $b->{$_}} @$a + Array Hash hash slice existence[1] @$a == grep $_ ~~ $b, @$a Regex Hash hash key grep[1] grep /$a/, keys %$b undef Hash always false (undef can't be a key) Any Hash hash entry existence exists $b->{$a} - Hash Array hash slice existence[1] @$b == grep {exists $a->{$_}} @$b Array Array arrays are comparable[2] Any Array match against an array element[3] - grep $a ~~ $_, @$b + grep $_ ~~ $a, @$b Hash Regex hash key grep grep /$b/, keys %$a Array Regex array grep grep /$b/, @$a