From: Adrian M. Enache Date: Fri, 21 Feb 2003 17:50:14 +0000 (+0200) Subject: [perl #20682] [fix] @- array not visible in s/// X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=83b43d9236da9ea6e31fd2df2474f4d7f7220a85;p=p5sagit%2Fp5-mst-13.2.git [perl #20682] [fix] @- array not visible in s/// Message-ID: <20030221155014.GB793@ratsnest.hole> p4raw-id: //depot/perl@18776 --- diff --git a/op.c b/op.c index e4f22cc..a89d29d 100644 --- a/op.c +++ b/op.c @@ -2630,7 +2630,7 @@ Perl_pmruntime(pTHX_ OP *o, OP *expr, OP *repl) if (curop->op_type == OP_GV) { GV *gv = cGVOPx_gv(curop); repl_has_vars = 1; - if (strchr("&`'123456789+", *GvENAME(gv))) + if (strchr("&`'123456789+-", *GvENAME(gv))) break; } else if (curop->op_type == OP_RV2CV) diff --git a/t/op/subst.t b/t/op/subst.t index 689b74f..f30f593 100755 --- a/t/op/subst.t +++ b/t/op/subst.t @@ -7,7 +7,7 @@ BEGIN { } require './test.pl'; -plan( tests => 127 ); +plan( tests => 128 ); $x = 'foo'; $_ = "x"; @@ -521,3 +521,9 @@ is("<$_> <$s>", "<> <4>", "[perl #7806]"); $_ = "1111"; is(s/(??{1})/2/eg, 4, '#20684 s/// with (??{..}) inside'); +# [perl #20682] @- not visible in replacement +$_ = "123"; +/(2)/; # seed @- with something else +s/(1)(2)(3)/$#- (@-)/; +is($_, "3 (0 0 1 2)", '#20682 @- not visible in replacement'); +