in reply to Removing duplicates

#!/perl -l use strict; use warnings; my %merge; while ( <DATA> ) { chomp; my ($key, $value) = split /\t/; $merge{$key}{$value} = $value; } for my $key ( keys %merge ) { my @values = keys %{$merge{$key}}; print "$key => @values"; } __DATA__ 1 101 2 102 3 103 1 104 2 102 3 104 __output__ 1 => 104 101 3 => 104 103 2 => 102

Update: First draft was wrong, misread of the question. Updated within 2 minutes. Apologies if anyone read the first version. :)

--
edan