in reply to Get identical elements and index from 2 Arrays in Perl
You can get both the index and the value from an array by iterating through it like this:
$ cat x.pl use strict; use warnings; my @foo = qw( apple pear banana ); while (my ($x,$y) = each @foo) { print "<$x, $y>\n"; } $ perl x.pl <0, apple> <1, pear> <2, banana>
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|