From: hal9000@... Date: 2001-07-13T04:13:11+09:00 Subject: [ruby-talk:17742] Re: Array#sort! returns nil when array empty > > foo = "This is a test" > foo.gsub!('foo','bar').gsub!(' ',"\t") > > does not work, but > > (foo.gsub!('foo','bar')||foo).gsub!(' ',"\t") > > does work, but is REALLY ugly. > I'm now thinking that perhaps the "right" way to do this is: foo.gsub('foo','bar').gsub!(' ',"\t") i.e., the earlier chained methods are non-bang. I'll try this line of thought for a while. Hal