summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorreneeb <unknown>2008-11-16 22:13:57 -0800
committerSteve Peters <steve@fisharerojo.org>2008-11-25 03:51:41 +0000
commitb08e453b5ad23d251311b831812c303bc4595012 (patch)
treec1370a4731e75dc069a28cb35218d24f0cd17e65 /op.c
parent8226a3d7ea7a9414bc41d73011d23876bd55e4b8 (diff)
downloadperl-b08e453b5ad23d251311b831812c303bc4595012.tar.gz
[perl #7911] no warning for useless /d in tr/0-9//d
From: "reneeb via RT" <perlbug-followup@perl.org> Message-ID: <rt-3.6.HEAD-10965-1226931231-1833.7911-15-0@perl.org> p4raw-id: //depot/perl@34905
Diffstat (limited to 'op.c')
-rw-r--r--op.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/op.c b/op.c
index b67983520b..10c1fc9be9 100644
--- a/op.c
+++ b/op.c
@@ -3451,6 +3451,15 @@ Perl_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
}
}
}
+
+ if(ckWARN(WARN_MISC)) {
+ if(del && rlen == tlen) {
+ Perl_warner(aTHX_ packWARN(WARN_MISC), "Useless use of /d modifier in transliteration operator");
+ } else if(rlen > tlen) {
+ Perl_warner(aTHX_ packWARN(WARN_MISC), "Replacement list is longer than search list");
+ }
+ }
+
if (grows)
o->op_private |= OPpTRANS_GROWS;
#ifdef PERL_MAD