in reply to Re: grep return the index instead of the element content, and its speed
in thread grep return the index instead of the element content, and its speed
my $index = 0; my $i = 0; my $key = 10; my @array = .... my $success = grep {$array[$_] eq $key && ($in = $_)} 0..$#array; $success is 0 if not found, 1 if found $in contain the offset index
|
|---|