On Dec 12, 2010, at 04:38 , Martin J. Dst wrote:

> h = {}
> (0..10).each do |e|
>  h[e%3] ||= []
>  h[e%3] << e%5
> end
> p h
> 
> Or shorter:
> 
> h = {}
> (0..10).each { |e| (h[e%3] ||= []) << e%5 }
> p h

Or shorter (and faster) still:

h = Hash.new { |h,k| h[k] = [] }
(0..10).each { |e| h[e%3] << e%5 }
p h