in reply to Re^2: Eval doesn't see lexicals
in thread Eval doesn't see lexicals

It would be nice to know why eval is choosing to ignore a lexical until it is named...

That's because Perl doesn't know (at compile time) whether the eval will run nor what it will contain, so it really can't bind to the appropriate lexical. One way to solve this may be to have every scope containing a string eval to bind every lexical in every parent lexical pad, but wow, what a cost.

It would surprise me if dave_the_m weren't along here shortly to give more details, especially where I started waving my hands over the details.