http://qs321.pair.com?node_id=83581


in reply to Idiomatic Array Index Search?

I agree with japhy on this one, simple things should be kept simple. Here is a variation on his get_index routine that combines his routine with other idioms mentioned in this node:

my $index = get_index(\@array, $element); sub get_index { my ($a, $e) = @_; $e eq $a->[$_] and return $_ for 0..$#$a; return -1; }