http://www.perlmonks.org?node_id=1002269


in reply to to find inter connected items

Node how to find combine common elements of an array? gives a few solutions to this problem. Your input set to those solutions would be a set of doubletons, each represented as a string of whitespace delimited elements, i.e., "$a[i] $b[i]".