Returns the index of the first element in LIST for which the criterion in BLOCK is true. Sets $_ for each item in LIST in turn:Update:
use List::MoreUtils qw/first_index/; my @array = ( 6, 5, 4, 3, 2, 1 ); my $first_4_idx = first_index { $_ == 4 } @array; print $first_4_idx;
In reply to Re: Finding values position in array
by FunkyMonk
in thread Finding values position in array
by cosmicperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |