develooper Front page | perl.perl5.porters | Postings from February 2003

Re: [perl #21321] local ${"FOO"} does not work

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
February 24, 2003 13:35
Subject:
Re: [perl #21321] local ${"FOO"} does not work
Message ID:
20030224223512.57e7270c.rgarciasuarez@free.fr
Enache Adrian wrote:
> On Sun, Feb 23, 2003 at 12:03:27AM +0100, Rafael Garcia-Suarez wrote:
> > The patch below solves this problem by moving this error message
> > from compile-time to run-time, and allowing the construct
> > C<local ${expression()}> as long as the expression() returns a
> > string, and not a reference.
> 
> $ perl -le '$a=1; { $b="a"; local $$b = 4; $b = 5; ${"a"} = 2 } print ${"a"}'
> 1
> (with your patch applied, of course)
> 
> If this is ok, why '$b=\$a; local $$b' isn't ?

Yes, why ? Because I didn't try to have it work. Will try.

> Shouldn't 'local $symref' work only with constant strings, at least ?

But this doesn't cause problems, does it ?

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