in reply to finding unique items in an array, from a text file
hiya - looks a bit overcomplicated, should be really simple. IMHO you don't need @lines, @uniq and %seen... only need one hash to do this.
I'd prefer to do something like this (off the top of my head, code not tested):
# open the file into FH my %uniq; $uniq{$_} = 1 while (<FH>); print join "\n", keys %uniq; # close the file
Hope that helps. All the best.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: finding unique items in an array, from a text file
by johngg (Canon) on Jan 13, 2009 at 23:27 UTC | |
by andye (Curate) on Jan 14, 2009 at 12:41 UTC |
In Section
Seekers of Perl Wisdom