From: Conrad Schneiker Date: 2000-03-17T02:09:09-06:00 Subject: [ruby-talk:01954] Re: Ruby Syntax similar to other languages? From: Yukihiro Matsumoto > In message "[ruby-talk:01896] Ruby Syntax similar to other languages?" > on 00/03/16, "David Douthitt" writes: > > |as a veteran vi user (and sed user) it was nothing for me to adjust to > | > | foo = s/this/that/g; > | > |but now with Ruby it seems this is > | > | foo.gsub!(/this/, "that") > | > |what? And if I don't want the "g" option, it's a completely different > |function: > | > | foo.sub!(/this/, "that") > | > |and if I don't want the original to be modified: > | > | foo.sub(/this/, "that") > | > |Can someone explain why all this is? There must be a method to this madness.... > |pun intended? > > sub/gsub is from awk. ! is inspired from scheme. This is one place where I would very much prefer a vi/sed/perl scheme! Is it possible to add something (standard) so that we could do: foo.s foo.s! with an optional extra parameter string for perl-ish modifier characters such as "g"? Conrad