Hmm, your requirement is not very clear to me (and probably to other monks as well, judging from the answers you've got so far), but if you want to compare lists, it seems to me that the List::Util and List::MoreUtils CPAN modules might be the first place to go.