Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Merging two list with simple operationby fanticla (Scribe) |
on Jul 31, 2010 at 17:48 UTC ( [id://852261]=perlquestion: print w/replies, xml ) | Need Help?? |
fanticla has asked for the wisdom of the Perl Monks concerning the following question: Hi monks My problem should be easy to solve, but I am still struggling very much to find a proper solution to it. I have two txt fils containing two lists of words - one word per line - with a score (the score simply being the row number). I'd like to merge the two files, ordering the words according with a new ranking computed by multiplying the scores of the same word in the two files. The files have the following format:
The output should look like:
I am by now reading FILE 1 line by line, reading through FILE 2 to match the same word, multiplying the scores and write the result out into a new file. As the list are huge, it seems to me a very BAD way to do this task. Any idea how I could do it better? Sorry if my question is too simple... Thanks, Cla
Back to
Seekers of Perl Wisdom
|
|