Numeric Variable Names With Leading Zeroes
Over on the p5p mailing list, a user raised the issue that use of variable
$00 is an error starting with Perl 5.32, and asked that this "regression" be fixed.
I have always understood that variables whose names begin with anything but an alphabetic or an underscore are reserved to Perl, and you mess with them at your peril. And this is the gist of the Porters' response to the post. Recent versions of
perlvar say this explicitly, though earlier versions of that document restrict themselves to describing currently-implemented special variables.
For what it's worth,
perl532delta appears not to mention this as a new diagnostic.
I wondered how much of this kind of thing was in CPAN, so I whipped up a
Perl::Critic policy to try to find them:
Variables::ProhibitNumericNamesWithLeadingZero. I then ran this against CPAN as it stood July 23 2022.
The only violation of this policy that I found was in line 1209 of
Net::Elexol::EtherIO24. The most recent release of this module (as of this writing) is August 11 2009. The line in violation (in context) is
1208 $txt .= sprintf("MAC: %02.2x:%02.2x:02.2x:02.2x:02.2x:02.2x ". 1209 "Fw: %02.2x.$02.2x", 1210 unpack("x$len CCCCCCCC", $cmd));
and looks to me very much like a typo for
%02.2x. The distribution requires a threaded Perl, and CPAN Testers show failures with
Error: Numeric variables with more than one digit may not start with '0' at Net-Elexol-EtherIO24-0.22-0/blib/lib/Net/Elexol/EtherIO24.pm line 1209. for Perl versions 5.32.1 and above. There are no reports for 5.32.0.
Under the circumstances I can not imagine anyone (other than maybe the original poster on p5p) actually wanting this perlcritic policy published, but I did stick it on GitHub for the curious.