Alexander Kellett
12/8/2004 4:47:00 PM
me bored
counts = array.inject(Hash.new { 0 }) { |counts, key| counts[key] += 1;
counts }
or something like that
On Dec 8, 2004, at 5:37 PM, pustoi@spils.lv wrote:
> Hello,
>
> Is there method in ruby like "uniq -c" command in Unix ?
> uniq -c, --count prefix lines by the number of occurrences
>
> Thnx
>