Fast array item search and fast file write
Posted on 2004-04-25
I do have a couple of questions and I'm ready to loose some points.
1 problem: I need a -fast- code to look for a substring in an array of strings. The strings are website names, so the strings may contain [ .,-,a-zA-Z, / ] symbols. The script should check if a given word is a part (sub string or equal) of any string in array. I wrote a perl script to do it, but I'm afraid it'll be way too slow for large number of searches.
2 problem: similar. fast way to flush results into a file. Should I keep one file open all the time the script is running, so I can write to it anytime, or is there a better way to do this?
Any advice greatly appreciated.