From: Brian Candler Date: 2009-02-03T05:49:54+09:00 Subject: Re: Hash counting STDERR.puts is your friend. > eventdateID.push eventsbydate.gsub(/\s/, '')[0..7] + > eventsbydate[26..30] STDERR.puts "A: #{eventdateID.inspect}" > counts = Hash.new(0) > if eventdateID.find {|d| (counts[d] +=1) >= 5} > @alerts.push("#{event.event_id} #{@tab} #{event.time_written} > #{@tab}#{event.event_type} #{@tab} #{type}") STDERR.puts "B: #{@alerts.inspect}" > end Then you can see if the data is what you expect before you go into the loop. Note that 'find' will abort after one successful match. Is that what you want? -- Posted via http://www.ruby-forum.com/.