From: "Mauricio Fernández" Date: 2002-12-03T17:31:00+09:00 Subject: Re: call-by-reference problem again On Tue, Dec 03, 2002 at 08:18:39AM +0900, Shannon Fang wrote: > Hi, > > I modified my code, I'm afraid that I can't find it. It is like the > following: > > class MailInfo > def initialize > @path=@recipients=@from=Array.new > ... > end > def parse > case header > when "TO", "CC", "BCC" > @recipients << header > when "RECEIVED" > @path << header > end > end > ... > end > > in the above code, the arrays will interfere with each other. The way to > solve it is not to use chained assignment. Yes, because they are all the same array :) But why is it any different from String(s)? -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com Linux - Das System fuer schlaue Maedchen ;) -- banshee