use strict; use warnings; ; #throw away first line my %names; while () { my ($name) = (split ' ',$_)[1]; print unless $names{$name}++; } =PRINTS 123 john 11 peter 87 helen =cut __DATA__ id name 123 john 34 john 567 john 11 peter 899 peter 87 helen