Created
January 5, 2012 08:29
-
-
Save huynguyen/1564257 to your computer and use it in GitHub Desktop.
Joe's Problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'csv' | |
# Real men use ruby1.9 thus not needing rubygems require and FasterCSV was | |
# folded into std-lib csv. Plus I had all these lines to waste on snarky | |
# comments. :P | |
puts CSV.read("joe.csv").flatten!.inject(Hash.new(0)) {|h,x| h[x] += 1; h} | |
# hnguyen@taengoo:~ ಠ_ಠ >> ./huy.rb | |
# {"junk"=>1, "name"=>1, "100"=>110, "joe"=>69, "tony"=>70, "david"=>3, "200"=>32} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment