in reply to Re: funky $_ with map {}
in thread funky $_ with map {}

$_ is less special than you think. It wouldn't have worked with a global named $foo either. The eval-solution you gave has already been given (by yours truly).

use vars qw($foo); { $foo = 'foo'; sub xyzzy { print "$foo\n"; } } $foo = 'bar'; xyzzy(); # Prints bar now.

But:
{ my $foo = 'foo'; sub xyzzy { print "$foo\n"; } } my $foo = 'bar'; xyzzy(); # Prints the 'foo' that stayed shared.


Update - s/\$f\b/\$foo/, thanks Kanji.

++ vs lbh qrpbqrq guvf hfvat n ge va Crey :)
Nabgure bar vs lbh qvq fb jvgubhg ernqvat n znahny svefg.
-- vs lbh hfrq OFQ pnrfne ;)
    - Whreq