This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fixes from Stephen McCamant that address bugs in change#3612
[perl5.git] / op.c
diff --git a/op.c b/op.c
index e7250f1..42b1c96 100644 (file)
--- a/op.c
+++ b/op.c
@@ -5123,7 +5123,9 @@ Perl_ck_sassign(pTHX_ OP *o)
        OP *kkid = kid->op_sibling;
 
        /* Can just relocate the target. */
-       if (kkid && kkid->op_type == OP_PADSV) {
+       if (kkid && kkid->op_type == OP_PADSV
+           && !(kkid->op_private & OPpLVAL_INTRO))
+       {
            /* Concat has problems if target is equal to right arg. */
            if (kid->op_type == OP_CONCAT
                && kLISTOP->op_first->op_sibling->op_type == OP_PADSV
@@ -5695,6 +5697,7 @@ Perl_peep(pTHX_ register OP *o)
                        goto ignore_optimization;
                    } else {
                        o->op_targ = o->op_next->op_targ;
+                       o->op_private |= OPpTARGET_MY;
                    }
                }
                null(o->op_next);