diff options
author | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1997-12-11 11:54:41 +0000 |
---|---|---|
committer | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1997-12-11 11:54:41 +0000 |
commit | 5d06d08e734fe734c4a9189071f394ad6e9ccaac (patch) | |
tree | 13aead60a9b95b42a7180d002d82a517bef8152b /op.c | |
parent | 3fe6f2dcb97acb1a1bb0a27dc5753fbc0548c545 (diff) | |
download | perl-5d06d08e734fe734c4a9189071f394ad6e9ccaac.tar.gz |
Stop tr/// from writing to target when only counting.
p4raw-id: //depot/perl@359
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1993,12 +1993,13 @@ pmtrans(OP *o, OP *expr, OP *repl) register I32 j; I32 Delete; I32 complement; + I32 squash; register short *tbl; tbl = (short*)cPVOPo->op_pv; complement = o->op_private & OPpTRANS_COMPLEMENT; Delete = o->op_private & OPpTRANS_DELETE; - /* squash = o->op_private & OPpTRANS_SQUASH; */ + squash = o->op_private & OPpTRANS_SQUASH; if (complement) { Zero(tbl, 256, short); @@ -2022,6 +2023,8 @@ pmtrans(OP *o, OP *expr, OP *repl) else { if (!rlen && !Delete) { r = t; rlen = tlen; + if (!squash) + o->op_private |= OPpTRANS_COUNTONLY; } for (i = 0; i < 256; i++) tbl[i] = -1; |