Destructive string operations working on multiple variables?

Hey all,

I guess this should go on the Ruby-list, but I failed to find what
it's called, so here goes.

This might be a bit of a stupid question, but I would like to
understand why what causes this behaviour:

params['string'] = "foo_bar"
@baz = params['string']
@baz.gsub!(/[_]/, ' ') #replace underscore with space
puts params['string'] # => "foo bar"

Why whould gsub!() alter the value in params? Same goes if I copy it
again and as far as I can tell even if variables doesn't have the
@-sign or using any other string operator ending with an explamation
point.

Does my equal sign make references rather then copies? Is there only
some occasions when that is true?

Thanks in advance,
Mathias.

Hey all,

I guess this should go on the Ruby-list, but I failed to find what
it's called, so here goes.

IMO the best place for ruby discussions is comp.lang.ruby on usenet.
For instance through
<http://groups-beta.google.com/group/comp.lang.ruby/topics>.

Does my equal sign make references rather then copies? Is there only
some occasions when that is true?

See 4.1 here <http://www.rubycentral.com/faq/rubyfaq.html>.

Isak