From: hongseok.yoon@... Date: 2006-03-08T17:43:41+09:00 Subject: ridiculous behavoir of Array#push and Array#clear See bellow code please. 1 obj1 = "object1" 2 obj2 = "object2" 3 obj3 = "object3" 4 5 arr1 = Array.new 6 arr2 = Array.new 7 8 arr1 << obj1 9 arr1 << obj2 10 11 arr2 << obj3 12 13 puts "" 14 arr1.each { 15 | element | 16 puts element 17 } 18 19 puts "" 20 arr2.each { 21 | element | 22 puts element 23 } 24 25 arr1.push( arr2 ) 26 puts "" 27 arr1.each { 28 | element | 29 puts element 30 } 31 32 arr2.clear 33 puts "" 34 35 puts "" 36 arr2.each { 37 | element | 38 puts element 39 } 40 41 puts "" 42 arr1.each { 43 | element | 44 puts element 45 } result is... object1 object2 object3 object1 object2 object3 object1 object2 In the last list of arr1, there's no object3. Why? Does Array#push() method append the array as a refrence? If so, why it does? And after arr2 had been cleared, I still can access to 3rd member of arr1 without exceptions or errors. Yes, I can use clone() method for Array#push. But before, I hope to know the reason why RUBY's Array#push method works like above. Thanks.