in reply to Unique array w/o repeated elements and still keep the original order!
you don't say if the repeated lines will be in succession(one right after the other) or if they can be spread out through the file. If it's random...then this is what i'd use....
TexasTess
"Great Spirits Often Encounter Violent Opposition From Mediocre Minds" --Albert Einstein
my @lines=(); open (FILE,"$tempfile5") || die "Cannot read from $tempfile5\n"; my $found = 0; while(<FILE>){ my $line_holder = $_; #DOH, should have had this here foreach my $val(@lines){ if($val eq $line_holder){$found = 1;} } if($found){ $found = 0; next; }else{ push @lines, $line_holder; } }
TexasTess
"Great Spirits Often Encounter Violent Opposition From Mediocre Minds" --Albert Einstein
In Section
Seekers of Perl Wisdom