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.
In reply to Re: find position of element of array
by friedo
in thread find position of element of array
by perlbeginner10
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |