irb(main):002:0> a.default = []
=> []
irb(main):003:0> a[8] << 9
=> [9] # great!
With this statement, you have modified the default; you have not created a new array and added "9". At this point, it's identical to if you had done this instead:
irb(main):002:0> a.default = [9]
=> [9]
Hence it's no surprise that you now get this:
irb(main):006:0> a[9]
=> [9] # unawesome! shouldn't this be [] ??
Furthermore, the '<<' added the '9' to the array; it did not add it to the hash, which explains this:
irb(main):004:0> a
=> {} # ?! would have expected {8=>[9]}
Instead of using .default, what you probably want to do in your program is something like this:
# Time to add a new entry to the hash table; this might be
# the first entry for this key..
myhash[key] ||= []
myhash[key] << value