From: Jean-Julien Fleck Date: 2010-07-21T00:41:35+09:00 Subject: Re: Count occurences of vars in array 2010/7/20 Harry Kakueki : > p Hash[*(arr.uniq.map{|x| [x,arr.select{|y| y == x}.length]}).flatten] Harry showed the way: >> Hash[arr.group_by {|o| o}.collect{|k,v| [k,v.size]}] => {"a"=>2, "b"=>3, "c"=>2} Cheers, -- JJ Fleck PCSI1 Lycée Kléber