Let's say I would like to create a new array of arrays
arr = Array.new(5,[])
=> [[], [], [], [], []]
How can I specifically push an element to one of those arrays?
When I try to push to only one of the arrays, the value is always added to all of them:
arr[3].push("foo")
=> ["foo"]
arr
=> [["foo"], ["foo"], ["foo"], ["foo"], ["foo"]]
Array.new.