in reply to A unique question help!
Hi
Just assign it to a hash and the hash will automagically remove all duplicates.
Example:
@list = ('a', 'a', 'a', 'b', 'c', 'd'); foreach(@list) { $unique{$_}++ } foreach(sort keys %unique) { printf "$_ : %s\n", $unique{$_} }
And if you also increase the value for each assignment to the hash you also get the number of duplicates.
|
|---|