in reply to Creating a non-redundant set

Maybe you can store all the pairs sorted in a hash:

use strict; use warnings; use Data::Dumper; my %data = (); while (<DATA>){ chomp; $data{join (' ',sort {$a cmp $b} split / /,$_)} = 1; } print Dumper \%data; __DATA__ ENSP000010 ENSP000011 ENSP000020 ENSP000050 ENSP000011 ENSP000010 ENSP000050 ENSP000020

Outputs:

VAR1 = { 'ENSP000020 ENSP000050' => 1, 'ENSP000010 ENSP000011' => 1 };

citromatik