summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--t/lib/warnings/toke3
-rw-r--r--toke.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke
index eb918f1afd..02c6cccca4 100644
--- a/t/lib/warnings/toke
+++ b/t/lib/warnings/toke
@@ -304,6 +304,9 @@ You need to quote "ふれど" at - line 5.
use warnings 'syntax' ;
$_ = "ab" ;
s/(ab)/\1/e;
+s//\(2)/e; # should be exempt
+s/${\2}//; # same here
+()="${\2}"; # metoo
no warnings 'syntax' ;
$_ = "ab" ;
s/(ab)/\1/e;
diff --git a/toke.c b/toke.c
index 2ed27a9dee..4ba35ac98f 100644
--- a/toke.c
+++ b/toke.c
@@ -6943,7 +6943,8 @@ Perl_yylex(pTHX)
case '\\':
s++;
- if (PL_lex_inwhat && isDIGIT(*s))
+ if (PL_lex_inwhat == OP_SUBST && PL_lex_repl == PL_linestr
+ && isDIGIT(*s))
Perl_ck_warner(aTHX_ packWARN(WARN_SYNTAX),"Can't use \\%c to mean $%c in expression",
*s, *s);
if (PL_expect == XOPERATOR)