in reply to Re: eval in perl package
in thread [SOLVED]: eval in perl package

> Perl sees that it uses a lexical variable from its declaration scope, so it keeps a link to that scalar value for the function to still be able to access it

To elaborate further, each sub (and each block?) has hash like structures called "Pads", where closed over variables are referenced.

This Pad is filled at compile time, and eval can only access lexical variables used in this scope.

PadWalker allows to inspect this pad, or the pad of surrounding scopes.

(PadWalker could also be used as a workaround for the OP)

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery