Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: nested loops to compare 2 files is only looping a limited number of times.by si_lence (Deacon) |
on Jun 23, 2009 at 13:37 UTC ( [id://774017]=note: print w/replies, xml ) | Need Help?? |
As noted above by SuicideJunkie you don't start from the beginning of the second file for each pass trough the outer loop, i.e. for each line of file1. If your second file is not too big (compared to memory available) I would suggest to read the second file into a hash before the first loop and then loop through file1 and look for matches. You only need one loop then and not the two nested ones. cheers si_lence
In Section
Seekers of Perl Wisdom
|
|