You forget to mention the other side of the trade-off: a hash trades memory for speed. grep will run in O(N), but also consume a lot less memory. It also requires a certain amount of work to set up the hash; if you're only going to test a particular set few times, it may well end up not amortizing that up front effort.
TANSTAAFL.
Makeshifts last the longest.
In reply to Re^3: writing perl function like sql IN
by Aristotle
in thread writing perl function like sql IN
by JAMBOID
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |