develooper Front page | perl.perl5.porters | Postings from July 2022

Re: perl -we '$00' dies in 5.32

Thread Previous | Thread Next
Walt Mankowski
July 24, 2022 14:34
Re: perl -we '$00' dies in 5.32
Message ID:
On Fri, Jul 22, 2022 at 01:23:04PM +0000, Konovalov, Vadim via perl5-porters wrote:
> My scripts suddenly stopped working in newer perl because they use $00 variable.
> $ perl -we '$00'
> Numeric variables with more than one digit may not start with '0' at -e line 1.

I'm confused by why you ever thought this would work. perlvar clearly

    Variable names in Perl can have several formats. Usually, they must
    begin with a letter or underscore ...

    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.

git blame says that section was last modified in 2015, but there is
similar language saying that identifiers need to start with a letter
or underscore in perldata in perl 5.004, which dates back to 1997.

> This works well in 5.26.0
> What this behaviour degrade was for?

It seems to me the change that broke your scripts was actually fixing
a bug that was allowing illegal variable names that are reserved by
Perl for regex backreferences.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About