From: Chris Chris Date: 2008-07-04T05:07:43+09:00 Subject: How to duplicate elements in array? Hi, something I couldn't quite figure out (sorry for posting so soon after my last question)... a = [["ABC", "30", "1"]] I want to duplicate/copy the element. This is what I'm trying to get: a2 = [["ABC", "30", "1"], ["ABC", "30", "1"]] What I did was simply a2 = a + a => [["ABC", "30", "1"], ["ABC", "30", "1"]] That works. I then tried changing a single element. a2[0][1] = "test" puts a2.inspect => [["ABC", "test", "1"], ["ABC", "test", "1"]] Of course, I just intended to change the first value, not both of them. Can anybody explain please what I can do about this? Thank you! Chris -- Posted via http://www.ruby-forum.com/.