# 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}++ ); } }
In reply to Re: to avoid redundacy in a file
by zejames
in thread to avoid redundacy in a file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |