my %test; open ... while (<$file>) { push @array, $_ unless $test{$_}++ }