Use => instead of : to indicate pairings in a hash. Hash keys can be mutable objects (see rehash). Inverting a hash does not automatically group duplicates into an array; you will lose entries if there were duplicate values.
hsh = { } hsh['key'] = 7 hsh2 = { "A"=>65, "B"=>66 }
Ruby supports default values for hashes.