From: David Alan Black Date: 2002-02-20T09:36:24+09:00 Subject: Re: Changing String Without Changing The Address Hello -- On Wed, 20 Feb 2002, Songsu Yun wrote: > Hi, > Based on what I have read, it seems that assignment just change the string > variable to point to the new string object. > Is it possible to just change the contents of a string object with the > string variable still pointing to the same string object ? > Thanks. Does this address what you're wondering about? irb(main):001:0> a = "string" "string" irb(main):002:0> b = a "string" irb(main):003:0> a.id 537736264 irb(main):004:0> b.id 537736264 # a and b are same object irb(main):005:0> a.sub!(/i/,'o') # change a "strong" irb(main):006:0> b # change visible in b "strong" irb(main):007:0> a.id 537736264 irb(main):008:0> b.id 537736264 # they're still the same object David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav