diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 57c8746e8c44..4088f20c147b 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -393,6 +393,11 @@ consisted of only ASCII characters. The real upper limit was as few as Chinese or Osage. Now an identifier in any language may contain at least 255 characters. +=item * + +Fixed parsing of array names starting with a digit in double-quotish +context under C. + =back =head1 Known Problems diff --git a/t/op/sub_lval.t b/t/op/sub_lval.t index bfb17a1ff1e8..982044ebef89 100644 --- a/t/op/sub_lval.t +++ b/t/op/sub_lval.t @@ -5,7 +5,7 @@ BEGIN { require './test.pl'; set_up_inc('../lib'); } -plan tests=>213; +plan tests=>215; sub a : lvalue { my $a = 34; ${\(bless \$a)} } # Return a temporary sub b : lvalue { ${\shift} } @@ -1041,6 +1041,14 @@ sub else119797 : lvalue { eval { (else119797(0)) = 1..3 }; is $@, "", '$@ after writing to array returned by else'; is "@119797", "1 2 3", 'writing to array returned by else'; + +{ # Being in UTF-8 used to break this + use utf8; + eval { (else119797(0)) = 1..3 }; + is $@, "", '$@ after writing to array returned by else'; + is "@119797", "1 2 3", 'writing to array returned by else'; +} + eval { (else119797(1)) = 4..6 }; is $@, "", '$@ after writing to array returned by if (with else)'; is "@119797", "4 5 6", 'writing to array returned by if (with else)'; diff --git a/toke.c b/toke.c index 0d7d9dc45923..d201be5b7729 100644 --- a/toke.c +++ b/toke.c @@ -3697,10 +3697,7 @@ S_scan_const(pTHX_ char *start) * (@foo, @::foo, @'foo, @{foo}, @$foo, @+, @-) */ else if (*s == '@' && s[1]) { - if (UTF - ? isIDFIRST_utf8_safe(s+1, send) - : isWORDCHAR_A(s[1])) - { + if (isDIGIT_A(s[1]) || isIDFIRST_lazy_if_safe(s+1, send, UTF)) { break; } if (memCHRs(":'{$", s[1]))