summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2001-04-07 11:52:40 +0000
committerGurusamy Sarathy <gsar@cpan.org>2001-04-07 11:52:40 +0000
commitc26ea50d9fd947ede98c9a5c8c05ff72fc15deaa (patch)
tree3ab7d3306e1da56cbad2ff9f361bc011f5ecbe8a
parent138f1810fbcb108e34b435101364ce91355912ad (diff)
downloadperl-c26ea50d9fd947ede98c9a5c8c05ff72fc15deaa.tar.gz
can't optimize away scope entry if tr/// is present
p4raw-id: //depot/maint-5.6/perl@9605
-rw-r--r--op.c1
-rwxr-xr-xt/op/tr.t10
2 files changed, 10 insertions, 1 deletions
diff --git a/op.c b/op.c
index 119489ccb7..5fe0a03980 100644
--- a/op.c
+++ b/op.c
@@ -2635,6 +2635,7 @@ Perl_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
I32 grows = 0;
register short *tbl;
+ PL_hints |= HINT_BLOCK_SCOPE;
complement = o->op_private & OPpTRANS_COMPLEMENT;
del = o->op_private & OPpTRANS_DELETE;
squash = o->op_private & OPpTRANS_SQUASH;
diff --git a/t/op/tr.t b/t/op/tr.t
index 3a0da2d21c..c7ba0d8c55 100755
--- a/t/op/tr.t
+++ b/t/op/tr.t
@@ -5,7 +5,7 @@ BEGIN {
@INC = '../lib';
}
-print "1..52\n";
+print "1..54\n";
$_ = "abcdefghijklmnopqrstuvwxyz";
@@ -301,3 +301,11 @@ print "ok 51\n";
($a = "R0_001") =~ tr/R_//d;
print "not " if hex($a) != 1;
print "ok 52\n";
+
+@a = (1,2); map { y/1/./ for $_ } @a;
+print "not " if "@a" ne ". 2";
+print "ok 53\n";
+
+@a = (1,2); map { y/1/./ for $_.'' } @a;
+print "not " if "@a" ne "1 2";
+print "ok 54\n";