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
In reply to Re^2: grep return the index instead of the element content, and its speed
by Anonymous Monk
in thread grep return the index instead of the element content, and its speed
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |