From: Adam Akhtar Date: 2008-08-28T14:38:28+09:00 Subject: Re: how to avoid passing by reference and how to copy objects thanks everyone for that. I typed along on irb to the examples presented and understand more about rubys behaviour with "copying" stuff. Its basically like (probably IS under the hood) Pointers. so for some arrays a and b a = b thats basically copying the pointers themselves. So whatever changes i make in A will be reflected in B. a = b.dup create some NEW pointers but which point to the same memory space. If i edit one of the members it will be reflected in both a and b. However if i substitute it for a totally different member im guessing new memory space is allocated and a pointer points to that new memory space. Hence the change is reflected in only one array. to get a copy where new memory space for duplicate objects is creted, you look towards marshall.. am i right (roughly) ... hmmm pointers in C was always tricky. -- Posted via http://www.ruby-forum.com/.