The problem is that the inner my $e is a completely different variable to the outer one, so that functions closing over the outer one don't ‘see’ it. To illustrate:
perl -wMstrict -e 'my $e = 77; my $f = sub { warn $e }; $f->(); { my $
+e = 22; $f->() } $f->();'