From: "Joseph E. Savard" Date: 2010-07-21T00:16:42+09:00 Subject: Re: Count occurences of vars in array h = Hash.new(0) ["a", "b", "a", "c", "c", "b", "b"].each {|s| h[s] += 1}; > From: Vitaliy Yanchuk > Reply-To: > Newsgroups: comp.lang.ruby > Date: Tue, 20 Jul 2010 22:47:27 +0900 > To: ruby-talk ML > Subject: Count occurences of vars in array > > Hello, everyone. > > Would be grateful if someone can tell, how can I do shortly (mb with one > method) from such example array > > ["a", "b", "a", "c", "c", "b", "b"] > > The result > a => 2 > b => 3 > c => 2 > > So, to count number of occurances > -- > Posted via http://www.ruby-forum.com/. >