On Fri, Sep 24, 2004 at 09:30:22AM -0700, Steve Fink wrote: > But I agree that it is doing a name lookup in the string eval case. > Although if you try it, you get puzzling results: > > perl -le 'sub x {my $foo = 1; return sub { eval q($foo++) } };$x=x();print > $x->(), $x->(), $x->()' > > prints 012 again. Which confused me, because Perl *can* do named lookups > of lexicals. The problem, apparently, is that it's doing the lookup but > not finding it.
With bleedperl, you'd get $ ./perl -wle 'sub x {my $foo = 1; return sub { eval q($foo++) } };$x=x();print $x->(), $x->(), $x->()' Variable "$foo" is not available at (eval 1) line 1. Variable "$foo" is not available at (eval 2) line 1. Variable "$foo" is not available at (eval 3) line 1. 000 $ -- Now is the discount of our winter tent -- sign seen outside camping shop