Use of the C</c> match modifier without an accompanying C</g> modifier
elicits a new warning: C<Use of /c modifier is meaningless without /g>.
+Use of C</c> in substitutions, even with C</g>, elicits
+C<Use of /c modifier is meaningless in s///>.
=back
(D deprecated) You are now encouraged to use the explicitly quoted form
if you wish to use an empty line as the terminator of the here-document.
+=item Use of /c modifier is meaningless in s///
+
+(W regexp) You used the /c modifier in a substitution. The /c
+modifier is not presently meaningful in substitutions.
+
=item Use of /c modifier is meaningless without /g
(W regexp) You used the /c modifier with a regex operand, but didn't
Use of /c modifier is meaningless without /g
+ Use of /c modifier is meaningless in s///
+
Mandatory Warnings
------------------
Use of "%s" without parentheses is ambiguous [check_uni]
# 20020328 mjd@plover.com at behest of jfriedl@yahoo.com
use warnings 'regexp';
"foo" =~ /foo/c;
+"foo" =~ /foo/cg;
no warnings 'regexp';
"foo" =~ /foo/c;
+"foo" =~ /foo/cg;
EXPECT
Use of /c modifier is meaningless without /g at - line 4.
########
use warnings 'regexp';
$_ = "ab" ;
s/ab/ab/c;
+s/ab/ab/cg;
no warnings 'regexp';
s/ab/ab/c;
+s/ab/ab/cg;
EXPECT
-Use of /c modifier is meaningless without /g at - line 5.
+Use of /c modifier is meaningless in s/// at - line 5.
+Use of /c modifier is meaningless in s/// at - line 6.
static char ident_too_long[] = "Identifier too long";
static char c_without_g[] = "Use of /c modifier is meaningless without /g";
+static char c_in_subst[] = "Use of /c modifier is meaningless in s///";
static void restore_rsfp(pTHX_ void *f);
#ifndef PERL_NO_UTF16_FILTER
break;
}
- /* issue a warning if /c is specified,but /g is not */
- if (ckWARN(WARN_REGEXP) &&
- (pm->op_pmflags & PMf_CONTINUE) && !(pm->op_pmflags & PMf_GLOBAL))
+ /* /c is not meaningful with s/// */
+ if (ckWARN(WARN_REGEXP) && (pm->op_pmflags & PMf_CONTINUE))
{
- Perl_warner(aTHX_ packWARN(WARN_REGEXP), c_without_g);
+ Perl_warner(aTHX_ packWARN(WARN_REGEXP), c_in_subst);
}
if (es) {