in reply to Re^4: Finding the index of a specific element in an array.
in thread Finding the index of a specific element in an array.
I down voted this because: once you add code to remember the index for use after the loop -- and omit the say :
my $pos; for my $i (0 .. $#array) { next unless $array[$i] == 7; $pos = i; last; } ## do something with $pos.
-- your code is at least as synthetic (by the standard of mjd's articles) as JavaFan's, if not more so:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Finding the index of a specific element in an array.
by chromatic (Archbishop) on Jan 25, 2012 at 19:43 UTC |