From 2474a784a94d8c70aea9c330d9f2a902b8a68b85 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Mon, 20 Sep 2010 22:05:34 -0700 Subject: [perl #20444] regex not evaluated in constant ?: $text =~ ( 1 ? /phoo/ : /bear/) used to be constant-folded to $text =~ /phoo/ This patch solves the problem by marking match and subst ops as OPf_SPECIAL during constant folding, so the =~ operator can tell not to take possession of it. --- op.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'op.h') diff --git a/op.h b/op.h index 2ffd3e6f16..da280b8b8d 100644 --- a/op.h +++ b/op.h @@ -142,6 +142,10 @@ Deprecated. Use C instead. /* On OP_HELEM and OP_HSLICE, localization will be followed by assignment, so do not wipe the target if it is special (e.g. a glob or a magic SV) */ + /* On OP_MATCH, OP_SUBST & OP_TRANS, the + operand of a logical or conditional + that was optimised away, so it should + not be bound via =~ */ /* old names; don't use in new code, but don't break them, either */ #define OPf_LIST OPf_WANT_LIST -- cgit v1.2.1