my %seen; while (<>) { my $key = $_; $key =~ s/^\S+\s+//; # eliminate first field unless ( $seen{$key}++ ) { print; } }