in reply to Re: How do I find the index of a specific array value?
in thread How do I find the index of a specific array value?
use List::Utils qw(first); my @array = qw( Apples Oranges Brains Toes Kiwi); my $search = "Toes"; my $index = first {$array[$_] eq $search} 0..$#array; print "index of $search = $index\n";
|
|---|