Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: optimal way of comparing 2 arraysby dragonchild (Archbishop) |
on Oct 19, 2005 at 19:49 UTC ( [id://501396]=note: print w/replies, xml ) | Need Help?? |
You're on the right track, but not quite. You're looking over @file2 once and @file1 twice. You can combine the loops for @file1 into a for-loop and you'll be slightly better off.
Of course, "best" is a difficult word to work with. Personally, I'd use Set and go for the intersection for both and the differences for the ones missing. My criteria for good software:
In Section
Seekers of Perl Wisdom
|
|