Two ways of achieving duplicate keys in a hash:
h1 = {}
h1.compare_by_identity
h1["a"] = 1
h1["a"] = 2
p h1 # => {"a"=>1, "a"=>2}
h2 = {}
a1 = [1,2,3]
a2 = [1,2]
h2[a1] = 1
h2[a2] = 2
a2 << 3
p h2 # => {[1, 2, 3]=>1, [1, 2, 3]=>2}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…