On Fri, Mar 14, 2003 at 05:54:53PM +0100, Rafael Garcia-Suarez wrote: > "Philippe 'BooK' Bruhat (via RT)" <perlbug-followup@perl.org> wrote: > > The following short piece of code is broken. > > > > $ cat print.pl > > #!/usr/bin/perl > > my %data = ( foo => 'bar' ); > > print( > > $data{foo}); ... > > $ perl5.8.0 -MO=Deparse print.pl > > print.pl syntax OK > > my(%data) = ('foo', 'bar'); > > print $main::data{'foo'}; > > That "main::" isn't normal. %data is lexical. > > That's a parsing problem. While trying to disambiguate between the > filehandle/indirect object "$data" and the value "$data{foo}" the > parser gets confused and forgets to look in the pad. Sticking a > STDOUT corrects the problem. It does look in the pad. But it tries to snap '$data' not '%data'. The '\n' causes yylex() to switch to the 0 case, and consequently clobber PL_last_lop. So the test at toke.c:3473 will fail - and '$' won't be changed into '%'. Yet another skipspace() won't hurt :) Regards Adi ---------------------------------------------------------------- --- /arc/perl-current/toke.c 2003-03-09 17:03:05.000000000 +0200 +++ toke.c 2003-03-14 23:00:23.000000000 +0200 @@ -3088,6 +3088,7 @@ Perl_yylex(pTHX) PL_oldbufptr = PL_oldoldbufptr; /* allow print(STDOUT 123) */ else PL_expect = XTERM; + s = skipspace(s); TOKEN('('); case ';': CLINE;Thread Previous | Thread Next