summaryrefslogtreecommitdiff
path: root/x2p
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2009-10-23 11:13:21 +0200
committerRafael Garcia-Suarez <rgs@consttype.org>2009-10-23 11:13:21 +0200
commit6cf7238579bd512306a71f8d84f26589241691ff (patch)
tree7c60526a5acc7a9416d92728a5885b08006c696f /x2p
parent43269761c362a1ad9ab57c5513879796142282fa (diff)
downloadperl-6cf7238579bd512306a71f8d84f26589241691ff.tar.gz
a2p match() faulty
While I was doing the $[ thing, I discovered a bug in a2p's handling of the match() operator. It uses a comma operator, which has unintended behaviour in list context (e.g., in a print statement). It also returns empty string for a non-match, rather than the required 0.
Diffstat (limited to 'x2p')
-rw-r--r--x2p/walk.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/x2p/walk.c b/x2p/walk.c
index 2890375366..86419c1faa 100644
--- a/x2p/walk.c
+++ b/x2p/walk.c
@@ -725,7 +725,7 @@ sub Pick {\n\
str_cat(str," =~ ");
str_scat(str,fstr=walk(1,level,ops[node+2].ival,&numarg,P_MATCH+1));
str_free(fstr);
- str_cat(str," && ($RLENGTH = length($&), $RSTART = length($`)+1)");
+ str_cat(str," ? scalar($RLENGTH = length($&), $RSTART = length($`)+1) : 0");
numeric = 1;
break;
case OUSERDEF: