This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix RT #6006: Regexp replaces using large replacement variables fail
[perl5.git] / op.c
diff --git a/op.c b/op.c
index 2c10b2b..69db999 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3332,7 +3332,9 @@ Perl_pmruntime(pTHX_ OP *o, OP *expr, bool isreg)
                    else if (curop->op_type == OP_PADSV ||
                             curop->op_type == OP_PADAV ||
                             curop->op_type == OP_PADHV ||
-                            curop->op_type == OP_PADANY) {
+                            curop->op_type == OP_PADANY ||
+                            curop->op_type == OP_SCOPE /* ${10} */
+                            ) {
                        repl_has_vars = 1;
                    }
                    else if (curop->op_type == OP_PUSHRE)
@@ -3344,9 +3346,9 @@ Perl_pmruntime(pTHX_ OP *o, OP *expr, bool isreg)
            }
        }
        if (curop == repl
-           && !(repl_has_vars
-                && (!PM_GETRE(pm)
-                    || PM_GETRE(pm)->extflags & RXf_EVAL_SEEN))) {
+           && !repl_has_vars
+           && (PM_GETRE(pm) && !PM_GETRE(pm)->extflags & RXf_EVAL_SEEN))
+       {
            pm->op_pmflags |= PMf_CONST;        /* const for long enough */
            pm->op_pmpermflags |= PMf_CONST;    /* const for long enough */
            prepend_elem(o->op_type, scalar(repl), o);