my %uniq=(); open(LIST, 'file.txt') or die "Error 1"; while() { chomp; $uniq{$_}=1; } close(LIST); #the %uniq hash keys now contain all the records with duplicates removed