in reply to wisdom needed: sorting an array
How about ...
my %counter; $counter{$_}++ while (<DATA>); print sort {$counter{$b} <=> $counter{$a}} keys %counter; __DATA__ 1 info 1 info 1 info 2 info 3 info 3 info 4 info 4 info 4 info 4 info
This increments a counter for each of the lines. Then sorts them in reverse count order.
Maybe this is close to what you want. Let us know if it needs any changes.
--
Steve Marvell
|
|---|