From: Robin Houston Date: Fri, 6 Apr 2001 18:10:14 +0000 (+0100) Subject: PATCH: $[ X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b0840a2a4e2429536ffb069928546c0cd4916ac8;p=p5sagit%2Fp5-mst-13.2.git PATCH: $[ Message-ID: <20010406181014.A18803@puffinry.freeserve.co.uk> p4raw-id: //depot/perl@9614 --- diff --git a/op.c b/op.c index 11cd640..aa0b1e7 100644 --- a/op.c +++ b/op.c @@ -6818,7 +6818,7 @@ Perl_peep(pTHX_ register OP *o) pop->op_next->op_type == OP_AELEM && !(pop->op_next->op_private & (OPpLVAL_INTRO|OPpLVAL_DEFER|OPpDEREF|OPpMAYBE_LVSUB)) && - (i = SvIV(((SVOP*)pop)->op_sv) - PL_compiling.cop_arybase) + (i = SvIV(((SVOP*)pop)->op_sv) - PL_curcop->cop_arybase) <= 255 && i >= 0) { diff --git a/t/op/array.t b/t/op/array.t index d48b5fb..122a49e 100755 --- a/t/op/array.t +++ b/t/op/array.t @@ -234,3 +234,16 @@ sub foo { "a" } @foo=(foo())[0,0]; $foo[1] eq "a" or print "not "; print "ok 71\n"; + +# $[ should have the same effect regardless of whether the aelem +# op is optimized to aelemfast. + +sub tary { + local $[ = 10; + my $five = 5; + print "not " unless $tary[5] == $tary[$five]; + print "ok 72\n"; +} + +@tary = (0..50); +tary();