in reply to How do I find the position of an element in an array?

my( $i ) = grep { evaluate($array[$_]) } 0 .. $#array;
Of course, you'd define evaluate() to test for the actual condition you're interested in.

Replies are listed 'Best First'.
Re: Answer: how do I find the position of an element in an unknown array
by runrig (Abbot) on Sep 21, 2001 at 23:00 UTC
    That should probably be:
    my @deletes = grep { evaluate($array[$_]) } 0..$#@array;