From: Pieter Hugo Date: 2009-11-25T01:11:44+09:00 Subject: Re: Difference between << and += for Strings and Arrays. Bug? Hi Guys Thanks for the quick responses and insights. While I understand the issue now I must confess that it perturbs my 'least surprise' expectation. Why was it decided that '<<' should reference the original object but '+' should create a new object. When one works with a variable one shouldn't need to worry about what other stuff is being modified due to a unintentional reference? What other operators are doing this? I noticed that the '.pop' array method was also modifying the referenced array a = [1,2] b = a b.pop results in a and be being [1] I worked around with a = [1,2] b = [] b += a b.pop Now b == [1] and a == [1,2], but its not as sleek. Is there maybe another way? -- Posted via http://www.ruby-forum.com/.