Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Remove duplicate entries

by 7stud (Deacon)
on Nov 17, 2010 at 02:06 UTC ( #871893=note: print w/replies, xml ) Need Help??


in reply to Remove duplicate entries

Whose to say what the correct team spelling is? If the data is the same for similarly spelled team names, how about comparing the data rather than the team name:

my %good_data; my @dups; while (my $line = <DATA>) { my @fields = split /,/, $line, 2; my $team_info = $fields[1]; if (! $good_data{$team_info} ){ $good_data{$team_info} = $line; } else { push @dups, $line; } } for (values %good_data) { print; } print "*" x 20, "\n"; for (@dups) { print; } __DATA__ Group One,Captain1,Phone Number,League Pos,etc. Group-One,Captain1,Phone Number,League Pos,etc. GroupOne,Captain1,Phone Number,League Pos,etc. Group Two,Captain2,Phone Number,League Pos,etc. Group Three,Captain3,Phone Number,League Pos,etc. --output:-- Group Three,Captain3,Phone Number,League Pos,etc. Group One,Captain1,Phone Number,League Pos,etc. Group Two,Captain2,Phone Number,League Pos,etc. ******************** Group-One,Captain1,Phone Number,League Pos,etc. GroupOne,Captain1,Phone Number,League Pos,etc.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://871893]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2017-01-19 05:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (168 votes). Check out past polls.