Then, $_ is giving you the index of the element, and you indirect it to get to the element itself.my @ARRAY = (...); my @result = map { do something with $_ and $ARRAY[$_] } 0..$#ARRAY;
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
In reply to •Re: Is there an equivalent $. for lists or arrays in map or foreach?
by merlyn
in thread Is there an equivalent $. for lists or arrays in map or foreach?
by bsdz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |