open file1 loop over file 1 extract each $word $results{$word} = 1 end-loop close file1 open file2 loop over file2 extract each $word $results{$word" += 2 #### Note: '+=', not '=' end-loop close file2 ## ### %results contains all of the words in both files. ### Words that appear in both files will have a value of '3'. ### Iterate over the %results keys and print only the ### when the value is '3'. ##
----
I Go Back to Sleep, Now.
OGB
In reply to Re: Extracting common words
by Old_Gray_Bear
in thread Extracting common words
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |