From: 7stud -- Date: 2012-12-27T06:59:12+09:00 Subject: Re: Accumulate total count for each month Robert Klemme wrote in post #1090246: > > > Why isn't that simple? Did you actually try it? > > require 'date' > > counts = Hash.new 0 > > ARGF.each do |line| > line.chomp! > counts[Date.parse(line)] += 1 > end > > counts.sort_by {|d,| k}.each do |d, c| > printf "%-20s %6d\n", d, c > end > > Cheers > > robert > 1.rb:10:in `block in
': undefined local variable or method `k' for main:Object (NameError) . . . . . . -- Posted via http://www.ruby-forum.com/.