in reply to Perl regex question

I generally think that “this is a very appropriate application for a Perl hash.” The process can work by loading the wordlist, thereby initializing the hash, with a zero counter in each bucket. Then run the file, using regular-expressions (or perhaps simply split) to isolate each successive word for lookup.

Once you've finished, use the final contents of the hash to update your MySQL database. In other words, “there's no reason to do this until after the file has been entirely processed.” The program simply issues UPDATE statements for each word whose count (in the hash) is non-zero.