in reply to Re: Re: Killing dupes
in thread Killing dupes

That code assumes that the lines are in some way ordered before you code is run.

The quickest way I can see to modify your code is:

open (DB,"flat-file.txt") or die "couldn't open flat-file.txt: $!"; my %seen; @content= grep {!$seen{$_}++} (<DB>);
(<DB>) creates an array, which we grep for unique elements. Well we really just throw out the duplicates because they create duplicate keys in %seen.

Though it would probably be better not to slurp the entire array into memory unless you really need to.

-Blake