in reply to Re: finding unique items in an array, from a text file
in thread finding unique items in an array, from a text file

I think there might be a couple of problems with your code.

The grep solutions suggested might be better if line order is to be preserved. Something like (again, not tested).

... my %seen = (); print grep ! $seen{ $_ } ++, <$fh>; ...

Cheers,

JohnGG

Replies are listed 'Best First'.
Re^3: finding unique items in an array, from a text file
by andye (Curate) on Jan 14, 2009 at 12:41 UTC
    All good points. ;)