But your basic problem is using two loops resulting in 880*75000 comparisons. And not the full scan of files.
Using lookup hashes %A and %B with would speed this up dramatically.
Just use $look;$sec;$cls as keys.
The fastest way are hash slices then:
@A{keys %B} will give you the intersection.
But maybe easier to understand is to loop over the keys of the smaller hash and to lookup in the bigger one. This will also preserve order.
Same principle of you want to avoid holding the bigger file in memory, just read it line per line while comparing against a hash of the smaller one.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
In reply to Re: how to avoid full scan in file.
by LanX
in thread how to avoid full scan in file.
by EBK
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |