in reply to word association problem
I'm not too experienced w/perl, but i can suggest some things based on my naiveity
1) if file a has a base word, i'd regex words that contain it out of file b. it can get messy though, because youd probably have to test against multiple sections of that word: lost lose losing -- all stem from lose, but in different tenses/forms their spelling changes drastically even on the root
2) you could use the soundex mod to get similar sounding words. and i believe there is a 'better than soundex' mod out there too.