This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
(perl #133850) allow @x{...} with space in sub-parse
authorTony Cook <tony@develop-help.com>
Wed, 29 May 2019 03:47:36 +0000 (13:47 +1000)
committerTony Cook <tony@develop-help.com>
Tue, 11 Jun 2019 06:08:36 +0000 (16:08 +1000)
t/lib/warnings/toke
toke.c

index eab22fb..5dbef1a 100644 (file)
@@ -1713,3 +1713,11 @@ $_ = "";
 s/^/ ${time} /e
 EXPECT
 Ambiguous use of ${time} resolved to $time at - line 4.
+########
+# NAME [perl #133850] another case
+use warnings;
+%x = qw(a b c d);
+$_ = "";
+s/^/ @x {a} /e
+EXPECT
+Scalar value @x{"a"} better written as $x{"a"} at - line 4.
diff --git a/toke.c b/toke.c
index c3390c2..61cdac4 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -6911,7 +6911,7 @@ Perl_yylex(pTHX)
        if (!PL_tokenbuf[1]) {
            PREREF('@');
        }
-       if (PL_lex_state == LEX_NORMAL)
+       if (PL_lex_state == LEX_NORMAL || PL_lex_brackets)
            s = skipspace(s);
        if (   (PL_expect != XREF || PL_oldoldbufptr == PL_last_lop)
             && intuit_more(s, PL_bufend))