summaryrefslogtreecommitdiff
path: root/op.h
diff options
context:
space:
mode:
authorDavid Caldwell <david@porkrind.org>2009-11-23 17:24:25 -0800
committerDavid Caldwell <david@porkrind.org>2010-05-22 02:28:22 -0700
commit4f4d7508b0c2c114e5f52420e0e87a853c5f642a (patch)
tree008d80915d83e246892b83fa06e46a3b2e21c6bf /op.h
parentdd9035cd5bdeced1187df399d27d526f3b30194b (diff)
downloadperl-4f4d7508b0c2c114e5f52420e0e87a853c5f642a.tar.gz
Add s///r (non-destructive substitution).
This changes s/// so that it doesn't act destructively on its target. Instead it returns the result of the substitution (or the original string if there was no match). In addition this patch: * Adds a new warning when s///r happens in void context. * Adds a error when you try to use s///r with !~ * Makes it so constant strings can be bound to s///r with =~ * Adds documentation. * Adds some tests. * Updates various debug code so it knows about the /r flag. * Adds some new 'r' words to B::Deparse.
Diffstat (limited to 'op.h')
-rw-r--r--op.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/op.h b/op.h
index 2109891c52..b9327bbb1f 100644
--- a/op.h
+++ b/op.h
@@ -376,6 +376,8 @@ struct pmop {
#define PMf_GLOBAL 0x00002000 /* pattern had a g modifier */
#define PMf_CONTINUE 0x00004000 /* don't reset pos() if //g fails */
#define PMf_EVAL 0x00008000 /* evaluating replacement as expr */
+#define PMf_NONDESTRUCT 0x00010000 /* Return substituted string instead
+ of modifying it. */
/* The following flags have exact equivalents in regcomp.h with the prefix RXf_
* which are stored in the regexp->extflags member. If you change them here,