Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: how to remove duplicate based on the first column value

by cbro (Pilgrim)
on Jun 10, 2003 at 15:05 UTC ( #264706=note: print w/ replies, xml ) Need Help??


in reply to how to remove duplicate based on the first column value

#!/usr/local/bin/perl my %hash; open (F,"testers.txt"); my @array = <F>; close(F); foreach (@array) { my ($key, $value) = split(/\|/); next if (exists $hash{$key}); $hash{$key} = $value; } # use this to verify while (my ($fkey,$fval) = each %hash) { print "$fkey|$fval\n"; }
I hope I didn't just do somebody's homework <g>


Comment on Re: how to remove duplicate based on the first column value
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://264706]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2015-07-07 06:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls