Re: perl syntax oddity
Yitzchak Scott-Thoennes <[email protected]>
| Newsgroups | gmane.comp.lang.perl.fun |
|---|---|
| Organization | bs"d |
| Message-ID | <[email protected]> |
On Thu, Sep 18, 2003 at 07:53:39PM -0000, Rafael Garcia-Suarez <[email protected]> wrote: > Yitzchak Scott-Thoennes wrote in perl.fwp : > >> > >> sub getaglob {*foo} > >> $foo = "pong\n"; > >> { local ${&getaglob} = "ping "; print $foo } > >> print $foo; > >> > >> fails with "Can't localize through a reference"! > > > > This error seems to be removed in 5.8.1 and it works there (though the > > error entry was erroneously left in perldiag). > > perldiag is still correct, because this error was only removed in some > cases. Perl 5.8.1 allows localization through a symbolic reference, but > not a hard one : > > $ bleadperl -le '$x="a";local $$x=2;print$a,$$x' > 22 > > $ bleadperl -le '$x=\"a";local $$x=2;print$$x' > Can't localize through a reference at -e line 1. Sorry for casting aspersions while leaping to conclusions...I grepped *.c and saw it there for 5.6.2 but not 5.8.1. I forgot to check *.h. So is it unintentional that you can localize through an expression resulting in a glob?