in reply to Re: Re: Re: Unique array w/o repeated elements and still keep the original order!
in thread Unique array w/o repeated elements and still keep the original order!
That is certainly != to what I wrote....
Exactly the point. In your code, each iteration of the loop assigns the next row to $_ (your while statement), then assigns the following line to $line_holder. The line assigned to $_ is never handled, so it just get's "skipped."
In any case, couldn't the whole process be reduced to
my %seen = () ; my @uniq_rows = grep { !$seen{$_}++ } <FILE> ;
?
Those who know that they are profound strive for clarity. Those who would like to seem profound to the crowd strive for obscurity. --Friedrich Nietzsche
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: Re: Re: Unique array w/o repeated elements and still keep the original order!
by demerphq (Chancellor) on Aug 09, 2002 at 21:05 UTC | |
by jynx (Priest) on Aug 09, 2002 at 21:17 UTC | |
by demerphq (Chancellor) on Aug 09, 2002 at 21:28 UTC |