From: Robert Gleeson Date: 2009-11-01T01:44:15+09:00 Subject: Re: In-place parameter modification Hello, Dave Anderson wrote: > Native to ruby are several methods that change passed-in parameters > in-place, such as chomp!(somestring). But I don't see any info on > creating these things myself. Is it possible to write methods that > change parameters this way? Yup, you can write your own mutating methods that mutate the receiver(like chomp!, gsub!, sub!, and so on), but you can't mutate any of the core classes because you cannot reassign self. If it were your own class, though, you might have: class MyString def initialize str @str = str end def append! @str << ' ruby' end def to_s @str end end str = MyString.new 'I love ' str.append! puts str # => 'I love ruby' chomp! takes one argument, and that is a seperator(or what to remove from the end of the string) Hope this helps some, Rob -- Posted via http://www.ruby-forum.com/.