What is an easy way to eliminate duplicate entries in an array? I am reading a file in that has as many as 19 duplicate entries, and I want to eliminate all but one of course. Here is an excert form my script:
open (PFZ, $outemp) or die ("could not open pfizer.tmp: $!"
open (OUT, ">file.txt" or die ("could not open output file: $!"
# split the file and perform extraction logic.
foreach $var1 (<PFZ>) {
my @fields = split ( /\t/, $var1);
foreach (@fields) {
next if ( $fields[3] !~ /$query/ );
print (OUT "$fields[17],$fields[3],$fields[13],$fields[5]\n"
}
}
Any help is appriciated.
open (PFZ, $outemp) or die ("could not open pfizer.tmp: $!"
open (OUT, ">file.txt" or die ("could not open output file: $!"
# split the file and perform extraction logic.
foreach $var1 (<PFZ>) {
my @fields = split ( /\t/, $var1);
foreach (@fields) {
next if ( $fields[3] !~ /$query/ );
print (OUT "$fields[17],$fields[3],$fields[13],$fields[5]\n"
}
}
Any help is appriciated.