in reply to limiting scope of 'eval'??

Something like:

$a = "VAR_A"; $b = qq[ package Nowhere; local ( $/, $_, $@, $0, $a, $b ); ## etc. print "VAR_B (\$a)\n"; ]; eval $b;

I'm not quite sure what you expect from \$a though, except an error?


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

Replies are listed 'Best First'.
Re^2: limiting scope of 'eval'??
by Crackers2 (Parson) on Aug 22, 2004 at 13:58 UTC

    You either have to use q instead of qq, or escape all your $ signs, otherwise they will be interpolated when you assign them to b instead of at eval time.

    So his use of \$a is correct afaik