Syntactic Confectionery Delight | |
PerlMonks |
Re: match two filesby Corion (Patriarch) |
on Jun 03, 2020 at 09:11 UTC ( [id://11117635]=note: print w/replies, xml ) | Need Help?? |
This is a FAQ. See perlfaq4 on How do I compute the intersection of two arrays?. Your code is slow because for every item in @lines1 it looks at all items in @lines2. If you precompute a lookup table ("hash", in Perl data structures) for the items in @lines2, you can find the items in @lines2 much faster.
In Section
Seekers of Perl Wisdom
|
|