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

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

Thread Previous | Thread Next
From:
Walt Mankowski
Date:
July 25, 2022 18:50
Subject:
Re: perl -we '$00' dies in 5.32
Message ID:
Yt7l0L1jI64A94yu@mawode.com
On Mon, Jul 25, 2022 at 06:28:14PM +0000, Konovalov, Vadim via perl5-porters wrote:
> > The fact that neither $00 nor $0 has any relation to regular expressions is
> > irrelevant, because ALL identifiers that start with digits are reserved in
> > Perl. $0, for instance, is the name of the program being executed.
> 
> Regexp ones are read-only, $0 isn't

Read-only or not, they're still reserved.

> 
> > 
> > > Not a big deal, actually.
> > > 
> > > I accept the point that my usage of perl is often non-common, with lots of non-standard approaches, so no-one else uses $00, so dropping $00 support is ok.
> > 
> > It seems to me the fact that you were ever able to use $00 was a bug in those
> > versions of Perl which has now been fixed.
> 
> No
> 
> $ perl -we '$0="qwerty"; print $0'
> qwerty
> 
> there is a concept that perl can "lie" itself on $0

Again, you're using an identifier reserved by Perl. $0 is a special
case documented in perlvar saying it's OK to modify it. I haven't been
able to find anything that implies it should be OK to use $00.

In any language, if you use reserved words for your own purposes you
run the risk of the behavior changing in future versions.
Unfortunately you got burned here.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About