summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-07-01 12:28:04 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-07-01 12:28:04 +0200
commitfb51372e8e462d7f3320e8a1b91a913f976aae12 (patch)
treea6123ddad0e335ee368d524bcad78e628f526803 /pp_ctl.c
parent9b5b006ca2dcfa112f22578f899526bce7d5e411 (diff)
downloadperl-fb51372e8e462d7f3320e8a1b91a913f976aae12.tar.gz
Make C<undef ~~ 0> and C<undef ~~ ""> not match (like in 5.10.0)
This makes ~~ commutative with regard to undef, and fixes an inconsistency, since C<undef ~~ [0]> was not matching, and ~~ should be distributive in this case.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 6bb5b40e5e..59ac8c12a8 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -4393,6 +4393,10 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other)
SP -= 2;
goto sm_any_scalar;
}
+ else if (!SvOK(d)) {
+ /* undef ~~ scalar ; we already know that the scalar is SvOK */
+ RETPUSHNO;
+ }
else
sm_any_scalar:
if (SvNIOK(e) || (SvPOK(e) && looks_like_number(e) && SvNIOK(d))) {