#! C:\Perl\bin\perl.exe use strict; my $file = "controls.txt"; open (FH, "< $file") or die "Can't open $file for read: $!"; my @lines; while () { push (@lines, $_); } my %seen = (); my @uniq = (); foreach @lines { unless ($seen{$item}) { #if we get here, we have not seen it before $seen{$item} = 1; push(@uniq, $item); } } close FH or die "Cannot close $file: $!"; print @lines; # see if it worked