On Tue, 05 Feb 2019 12:06:23 -0800, twwilliams@k12.wv.us wrote: > On Perl 5.26 on Windows, an array or hash variable can take an integer > as its name. > > C:> perl -e "@3=(10,20,30); print $3[1]" > 20 > C:> > > Multiple digits work too. > > C:>perl -e "@217=('aa','bb','cc','dd'); print $217[2]" > cc > C:> > > ...and hashes. > > C:>perl -e "%217=('aa','bb','cc','dd'); print $217{aa}" > bb > C:> This isn't a bug. > ...but not scalars. > > C:>perl -e "$7='seven'; print $7" > Modification of a read-only value attempted at -e line 1. Neither is this. Numeric named scalars are reserved for regular expression captures: C:\Users\Tony>perl -le "$_ = 'abc123'; /(\d+)/; print $1" 123 From perlvar: Perl variable names may also be a sequence of digits, a single punctuation character, or the two-character sequence: "^" (caret or CIRCUMFLEX ACCENT) followed by any one of the characters "[][A-Z^_?\]". These names are all reserved for special uses by Perl; for example, the all-digits names are used to hold data captured by backreferences after a regular expression match. Tony --- via perlbug: queue: perl5 status: new https://rt.perl.org/Ticket/Display.html?id=133827Thread Next