You could do that, but people generally don't like to clutter grep/map with more statements than are absolutely necessary. A { @foo } is less typing and not so ambigious that I'd feel bad about putting it into production code.
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
In reply to Re: Localize $_ in grep
by hardburn
in thread Localize $_ in grep
by InfiniteSilence
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |