summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorYitzchak Scott-Thoennes <sthoenna@efn.org>2004-03-18 14:24:09 -0800
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-03-20 11:49:21 +0000
commit984200d0e3101dedd636f99bf5d5603033f7162d (patch)
tree867c615f204a71c92176ddd5c4de4f1f76dcd343 /toke.c
parent9848074ef898647100f4775f49bd1d52e0441e23 (diff)
downloadperl-984200d0e3101dedd636f99bf5d5603033f7162d.tar.gz
warn on !=~
Message-ID: <20040319062035.GA3768@efn.org> with an improvement suggested by Ton Hospel. p4raw-id: //depot/perl@22542
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/toke.c b/toke.c
index a26c724f95..46aa3aa0ac 100644
--- a/toke.c
+++ b/toke.c
@@ -3382,8 +3382,20 @@ Perl_yylex(pTHX)
case '!':
s++;
tmp = *s++;
- if (tmp == '=')
+ if (tmp == '=') {
+ /* was this !=~ where !~ was meant? */
+ if (*s == '~' && ckWARN(WARN_SYNTAX)) {
+ char *t = s+1;
+
+ while (t < PL_bufend && isSPACE(*t))
+ ++t;
+
+ if (*t == '/' || (*t == 'm' && !isALNUM(t[1])) || *t == '?')
+ Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
+ "!=~ should be !~");
+ }
Eop(OP_NE);
+ }
if (tmp == '~')
PMop(OP_NOT);
s--;