From: Hal Fulton Date: 2003-09-04T14:45:08+09:00 Subject: Re: Multiple gsub statements in one line possible? Kurt Euler wrote: > All- > > For the string called pkg_bug_base, I'm currently using the following code to make some substitutions: > > pkg_bug_base.gsub!(//, sp_num_string) > pkg_bug_base.gsub!(//, rel_num) > > Question: Is there a way to put this all on one line? I tried this, but the code crashed here: > > pkg_bug_base.gsub!(//, sp_num_string).gsub!(//, rel_num) What probably happened s that the first gsub! didn't actually change anything. In that case, it returns nil. This is a feature that allows you to test whether anything was changed. Unfortunately, it also prevents safe chaining. I'll bet your error was that nil doesn't have a gsub! method or something like that. If so, this is what happened. Hal