From: Michel Demazure Date: 2010-07-25T18:05:25+09:00 Subject: Re: Count occurences of vars in array David Masover wrote: > > Hash.new(0).tap{|h| arr.each{|e| h[e] += 1} } Yes ! I always use this construct. Instead of obj = Klass.new # do something to obj obj I use Klass.new do |obj| # do something to obj end which, at least to me, has a better look. _md -- Posted via http://www.ruby-forum.com/.