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


in reply to Remove duplicate entries

Normalise the key (remove the junk characters) and use it as a hash key.
my %seen; while (<>) { my @fields = ...; my $key = normalise($fields[0]); print { $seen{$key}++ ? $unique_fh : $extras_fh } $_; }