diff options
author | Yitzchak Scott-Thoennes <sthoenna@efn.org> | 2004-03-18 14:24:09 -0800 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-03-20 11:49:21 +0000 |
commit | 984200d0e3101dedd636f99bf5d5603033f7162d (patch) | |
tree | 867c615f204a71c92176ddd5c4de4f1f76dcd343 /toke.c | |
parent | 9848074ef898647100f4775f49bd1d52e0441e23 (diff) | |
download | perl-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.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -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--; |