Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question: ⭐ (arrays)
but I'd like to use map. Is there a way to access the map index [$i] variable so I can do something like this:@a = (1,1,1); @b = (2,2,2); foreach $i (0 .. $#a) { $a[$i] += $b[$i]; }
Or is it simply not worth it?@a = map $a[$i] + $_, @b;
Originally posted as a Categorized Question.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How can I access the index variable in map?⭐
by Kanji (Parson) on Nov 02, 2000 at 08:23 UTC | |
|
Re: How can I access the index variable in map?⭐
by chromatic (Archbishop) on Nov 02, 2000 at 07:48 UTC |