From: Jason Williams Date: 2003-12-18T04:32:02+09:00 Subject: Re: gsub question On 2003-12-17, Daniel Bretoi wrote: > perl -e '$a="hello hi hello";$a =~ s/(\w+)/$1a/g;print $a; ' > helloa hia helloa > > ruby -e 'a="hello hi hello";a.gsub!(/(\w+)/,"#{$1}a"); puts a' > a a a > The interpolation (AIUI) is done before the string gets passed to gsub!, so gsub! sees just the string "a". I think you want a="hello hi hello";a.gsub!(/(\w+)/,'\1a'); puts a