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 $_ ~~ $b, @$a
- Regex Hash hash key grep[1] grep /$a/, keys %$b
+ Array Hash hash slice existence @$a == grep $_ ~~ $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}
Any Any string equality $a eq $b
- 1 - empty hashes or array won't match.
+ 1 - empty hashes or arrays will match.
2 - that is, each element matches the element of same index in the other
array. [3]
3 - If a circular reference is found, we fall back to referential equality.
HV *hv = (HV*) SvRV(d);
I32 numkeys = hv_iterinit(hv);
if (numkeys == 0)
- RETPUSHNO;
+ RETPUSHYES;
while ( (he = hv_iternext(hv)) ) {
ENTER;
SAVETMPS;
AV *av = (AV*) SvRV(d);
const I32 len = av_len(av);
if (len == -1)
- RETPUSHNO;
+ RETPUSHYES;
for (i = 0; i <= len; ++i) {
SV * const * const svp = av_fetch(av, i, FALSE);
ENTER;
! [1] \&foo
! {a=>1} \&foo
# empty stuff matches, because the sub is never called:
-! [] \&foo
-! {} \&foo
+ [] \&foo
+ {} \&foo
! qr// \&foo
! undef \&foo
undef \&bar
@ "foo" \&fatal
@ qr// \&fatal
# sub is not called on empty hashes / arrays
-! [] \&fatal
-! +{} \&fatal
+ [] \&fatal
+ +{} \&fatal
# HASH ref against:
# - another hash ref