From: Abhi Yerra Date: 2009-01-17T07:04:33+09:00 Subject: Re: create copy of array without changing original On Sat, Jan 17, 2009 at 05:06:21AM +0900, Jason Lillywhite wrote: > Why is it that if I create an array, a = [1,2,3] > then do b = a > then b[0] = 99 > > why is that a[0] magically becomes 99 too? > b = a points to the same area of memory as a for lists. > how can I preserve 'a' after I make a copy of it, then change that new > copy? b = a.clone Should copy the list. > -- > Posted via http://www.ruby-forum.com/.