in reply to Pair of items

Sounds like a simple intersection to me. If so, the Set::Array module might fit your needs.