A number of replies use the grep built-in to scan an array for the presence of an element of another array. The problem with grep is that it will always scan the entire array even though the OPer only seems interested in the first occurrence of the element in the scanned array. List::MoreUtils::any will stop scanning at the first occurrence. For some value of the product of the sizes of the two arrays (100,000? 1,000,000? ...? Benchmark to find out), this difference in behavior will result in a significant performance win for any. For sufficiently small arrays, the difference is trivial.
In reply to Re: Failed array attemp
by AnomalousMonk
in thread Failed array attemp
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |