From: Morgan Grubb Date: 2007-08-21T01:20:42+09:00 Subject: Assignment as a reference? ------=_Part_124778_27640752.1187626847697 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, I ran into a simple issue earlier with assignment seeming to make references. I'm new to Ruby so perhaps this is how it's supposed to be. Here is an abridged version of what happened: foo = 'bar' #=> bar foo2 = foo #=> bar foo = foo.gsub 'bar', 'wibble' #=> wibble foo2 #=> bar foo = 'bar' #=> bar foo2 = foo #=> bar foo.gsub! 'bar', 'wibble' #=> wibble foo2 #=> wibble You can paste those straight into irb and get the same output. Could someone please explain why the second example changes foo2? Cheers, Morgan Grubb. ------=_Part_124778_27640752.1187626847697--