This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
do-file should not force a bareword
[perl5.git] / toke.c
diff --git a/toke.c b/toke.c
index 1fa09d1..a51bf4d 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -7341,8 +7341,13 @@ Perl_yylex(pTHX)
            s = SKIPSPACE1(s);
            if (*s == '{')
                PRETERMBLOCK(DO);
            s = SKIPSPACE1(s);
            if (*s == '{')
                PRETERMBLOCK(DO);
-           if (*s != '\'')
-               s = force_word(s,WORD,TRUE,TRUE,FALSE);
+           if (*s != '\'') {
+               d = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, 1, &len);
+               if (len) {
+                   d = SKIPSPACE1(d);
+                   if (*d == '(') s = force_word(s,WORD,TRUE,TRUE,FALSE);
+               }
+           }
            if (orig_keyword == KEY_do) {
                orig_keyword = 0;
                pl_yylval.ival = 1;
            if (orig_keyword == KEY_do) {
                orig_keyword = 0;
                pl_yylval.ival = 1;