Re:Why perl has separate arrays and hashes: It's as if they ...
by JulianMorrison on Tuesday June 21, 2011 @12:56PM
(#2679477)
Ruby even makes it invisible because of destructuring assignment of block variables.
ruby-1.9.2-p180 > {1=>2}.each {|k,v| puts "#{k} #{v}"}
1 2
=> {1=>2}
ruby-1.9.2-p180 > {1=>2}.sort.each {|k,v| puts "#{k} #{v}"}
1 2
=> [[1, 2]]
Ruby allows this. Both arrays and hashes provide an each method and include the Enumerable module.