summaryrefslogtreecommitdiff
path: root/pod/perlsyn.pod
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-03-25 23:55:34 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-03-25 23:55:34 +0100
commitc3886e8b3633df50e9636123f8fe89c9e6378436 (patch)
treeac39d0f14257dc5d64a54b0c98c1869feb2f77f4 /pod/perlsyn.pod
parent7c41e62ef63f12c6c4bde601a6af608e863d3f10 (diff)
downloadperl-c3886e8b3633df50e9636123f8fe89c9e6378436.tar.gz
Adjustments to the ~~ dispatch table
Hash slice existence now uses 'exists' instead of the complex recursive invocation to ~~. Any ~~ Array matches now keep the "any" element on the LHS of the smart match. More special cases have been added for complex values of "Any".
Diffstat (limited to 'pod/perlsyn.pod')
-rw-r--r--pod/perlsyn.pod7
1 files changed, 5 insertions, 2 deletions
diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod
index f356d55ada..ba4ae2aa58 100644
--- a/pod/perlsyn.pod
+++ b/pod/perlsyn.pod
@@ -688,14 +688,17 @@ 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 grep $_ ~~ $b, @$a
+ Array Hash hash slice existence grep { exists $b->{$_} } @$a
Regex Hash hash key grep 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 grep { exists $a->{$_} } @$b
Array Array arrays are comparable[2]
+ Regex Array array grep grep /$a/, @$b
+ undef Array array contains undef grep !defined, @$b
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