develooper Front page | perl.perl5.porters | Postings from May 2013

Re: [perl #117907] On RHS of s///, ${9} works but ${10} does not

Thread Previous
From:
Nicholas Clark
Date:
May 8, 2013 08:32
Subject:
Re: [perl #117907] On RHS of s///, ${9} works but ${10} does not
Message ID:
20130508083221.GR3729@plum.flirble.org
On Wed, May 08, 2013 at 01:47:48AM -0400, Eric Brine wrote:
> On Tue, May 7, 2013 at 10:35 AM, Dave Mitchell <davem@iabyn.com> wrote:
> 
> > $ perl589 -e'use strict; $9; ${9}; $10; ${10}'
> > Can't use string ("10") as a SCALAR ref while "strict refs" in use at -e
> > line 1.
> >
> > I don't know if there is any rationale behind this, but a first glance it
> > indeed seems like a bug.
> >
> 
> No other type of variable seems to generate a strict error.
> 
> >perl -E"use strict; my $xyz; ${xyz} = 1; say 'ok'"
> ok
> 
> >perl -E"use strict; my $xyz; ${^I} = 1; say 'ok'"
> ok

Knowing how the implementation has to handle the mutli-character numeric
variables specially (well, differently specially) this doesn't actually
surprise me. (Regular identifiers start with a number. Punctuation variables
are one character. Control character variables start with a control
character. The sequence "10" is none of these.)

Still, I agree with Dave that it feels like a bug. It suggests that the
differently-special code needs to be added in yet another place.

Nicholas Clark

Thread Previous


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