From: Mike Onofrietto Date: 2012-07-15T02:31:55+09:00 Subject: Re: method clear wiping out other array ? Ryan Davis wrote in post #1068678: > On Jul 13, 2012, at 23:31 , Mike Onofrietto wrote: > >> Thanks. I'll look into it. To me they should be two separate objects so >> I would not expect the two names to refer to the same array. > > variables are not objects. variables are names given to references to > objects. After var2=var1 you had this setup: > > var1 --> +-----+ > | obj | > var2 --> +-----+ Ryan, Thanks. So the assignment is actually a pointing/reference operation rather than a copy operation. As such the assigment caused me to lose all reference to the other array object. I came up with a work-around, and now my code works well. Thanks again. -- Posted via http://www.ruby-forum.com/.