Yes, grep is the correct operator, not map. See - I did bork my code. :-)
As for the +5M lines thing - that becomes a function of your available RAM. Your string solution will hit the same limit, but at around 20-30M (if 5M is your limit with hashes).
Note, your code to build the hash string will bomb faster than your code to iterate through it because you use foreach instead of while to iterate through the list. This creates a copy of the list you're foreach'ing through whereas while does not.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
| [reply] |