in reply to Removing duplicates

This peace of code does exactly what you want.
#!/usr/bin/perl my %t; while ( defined($_ = <DATA>) ){ chomp; my ($k, $v) = split /\s+/; push @{$t{$k}}, $v; } for ( sort keys %t ) { my %q; @q{@{$t{$_}}} = (); print "$_ ", join( ' ', sort keys %q), "\n"; } __DATA__ 1 101 2 102 3 103 1 104 2 102 3 104
Boris