From: Karl von Laudermann Date: 2008-01-09T23:50:00+09:00 Subject: Re: Why this behaviour? On Jan 9, 9:35 am, Daniele Antani wrote: > Hello to all, > > i can't understand the follow behaviour: > > class Player > attr_accessor :hand > def initialize(hand) > @hand = hand > end > end > Why the change affects both objects? I want to copy the first object and > work on the copy without affecting the original. Both Player objects contain a reference to the same array. What you want is this: class Player attr_accessor :hand def initialize(hand) @hand = hand.clone end end