in reply to Re^3: Accessing lexicals in other scopes dynamically by name
in thread Accessing lexicals in other scopes dynamically by name

Indeed it has nothing (or little) to do with garbage collection.

IMHO it's the dynamic scope (i.e. the scope local has), eval can access the surrounding lexpads of f's closure only as long as there is a call chain connecting them, because the "capture" of $a is missing!

use strict; { my $a = \$a; print "a=$a\n"; sub f { my $var = shift; print $var, "=", eval "\$$var", "\n"; }; i(); # works } #&f("a"); sub g { f("a") } sub h { g() } sub i { h() }

Cheers Rolf