in reply to how to compare column 1 to column 2 and vice versa from multiple rows.

Something like this:
my %seen; while (my $line = <>) { chomp $line; print $line if $seen{ join '', sort split /\s+/, $line }++; }

Use a hash to check for duplicates. Compose a key for the hash in such a way that rows having similar columns give same keys.

Update: Missed ++ has been added.