From: rickyr Date: 2009-10-08T12:55:08+09:00 Subject: Re: How to do explicit copy On Oct 6, 10:50 pm, Patrick Okui wrote: > On Oct 6, 2009, at 6:45 PM, rickyr wrote: > > > y = x > > y = x.dup may be sufficient for you (it does a shallowcopy). > > -- > patrick Thanks, it worked. Now, what are the differences between object#dup and object#clone. Both doing shallow copy. Also, when I do this a = Hash.new puts(a.id) Ruby whines no such method existed. The docs mentioned object#id, and all are descendant of object class. What's wrong? How can I verify (other than a handful of puts) if indeed two objects do not share the same data, but each has own copy? TIA