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 reply to Re: match two files
by Corion
in thread match two files
by yueli711
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |