in reply to to avoid redundacy in a file

One way to do it
# We are modifying the $/ variable, so we limit the scope # by adding some {} around the code { local $/ = ''; $^I = '.bak'; # See man perl and the -i switch for that trick @ARGV = ('data.txt'); while (<>) { # The order is not important, so we sort the fields to # obtain a unique id $sorted = join ':', sort split /\s+/; print if (! $seen{$sorted}++ ); } }

HTH
Update : add comments to the code
--
zejames