Everytime you use grep, you are iterating through the list. Since you do that inside of loop, your algorithm is O(N*M). In contrast, JediWizard iterates once through a loop so his algorithm is linear. His approach is also conceptually simpler which results in cleaner code.
-sauoq "My two cents aren't worth a dime.";
In reply to Re^2: Match string in array
by sauoq
in thread Match string in array
by nimdokk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |