in reply to Get identical elements and index from 2 Arrays in Perl
The easiest way is to increment a variable $index++ inside your @B loop.
Please note that swapping the loops would make sense here.
The most efficient way though would be using a hash %A to lookup set elements in @A thus avoiding that loop.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
|
|---|