in reply to find position of element of array
my ($index) = grep { $array[$_] eq 'c' } 0..$#array;
Then just subtract one from $index. (Watch out of $index happens to be zero though.)
Update: Forgot list context for $index.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: find position of element of array
by spatterson (Pilgrim) on Nov 07, 2005 at 12:26 UTC |