This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
spurious "Use of "-x" without parentheses" mesg
[perl5.git] / toke.c
diff --git a/toke.c b/toke.c
index 88c4348..0f169a2 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -2186,7 +2186,9 @@ S_postderef(pTHX_ char const funny, char const next)
        PL_bufptr+=2;
     }
     else {
-       if ('@' == funny) PL_lex_dojoin = 2;
+       if ('@' == funny && PL_lex_state == LEX_INTERPNORMAL
+        && !PL_lex_brackets)
+           PL_lex_dojoin = 2;
        PL_expect = XOPERATOR;
        PL_bufptr++;
     }
@@ -5706,7 +5708,6 @@ Perl_yylex(pTHX)
                DEBUG_T( { printbuf("### Saw unary minus before =>, forcing word %s\n", s); } );
                OPERATOR('-');          /* unary minus */
            }
-           PL_last_uni = PL_oldbufptr;
            switch (tmp) {
            case 'r': ftst = OP_FTEREAD;        break;
            case 'w': ftst = OP_FTEWRITE;       break;
@@ -5745,6 +5746,7 @@ Perl_yylex(pTHX)
                break;
            }
            if (ftst) {
+                PL_last_uni = PL_oldbufptr;
                PL_last_lop_op = (OPCODE)ftst;
                DEBUG_T( { PerlIO_printf(Perl_debug_log,
                         "### Saw file test %c\n", (int)tmp);
@@ -5779,6 +5781,10 @@ Perl_yylex(pTHX)
                  ||(*s == '*' && (s[1] == '*' || s[1] == '{'))
                 ))
                {
+                   Perl_ck_warner_d(aTHX_
+                       packWARN(WARN_EXPERIMENTAL__POSTDEREF),
+                       "Postfix dereference is experimental"
+                   );
                    PL_expect = XPOSTDEREF;
                    TOKEN(ARROW);
                }
@@ -8028,8 +8034,9 @@ Perl_yylex(pTHX)
                    strnEQ(p, "our", 3) && isSPACE(*(p + 3)))
                    p += 3;
                p = PEEKSPACE(p);
+                /* skip optional package name, as in "for my abc $x (..)" */
                if (isIDFIRST_lazy_if(p,UTF)) {
-                   p = scan_ident(p, PL_tokenbuf, sizeof PL_tokenbuf, TRUE);
+                   p = scan_word(p, PL_tokenbuf, sizeof PL_tokenbuf, TRUE, &len);
                    p = PEEKSPACE(p);
                }
                if (*p != '$')
@@ -9421,7 +9428,7 @@ S_scan_ident(pTHX_ char *s, char *dest, STRLEN destlen, I32 ck_uni)
     char *d = dest;
     char * const e = d + destlen - 3;    /* two-character token, ending NUL */
     bool is_utf8 = cBOOL(UTF);
-    I32 orig_copline, tmp_copline = 0;
+    I32 orig_copline = 0, tmp_copline = 0;
 
     PERL_ARGS_ASSERT_SCAN_IDENT;