From: "Aleksi Niemelä" Date: 2000-06-13T17:36:27+02:00 Subject: [ruby-talk:03370] Re: chomp! > I would have described chomp and chomp! as removing a new line, > if present, otherwise not affecting the string at all. Well, the biggest difference compared to your description is that one can specify "the new line". And compared to Perl you can accomplish it without using $/. Moreover I'm interested in why Kernel.chomp is profoundly different than String.chomp (the former doesn't return nil in any case). It might cause these two programs to work differently and I, for one, wouldn't expect it. while gets # change $/ foo = chomp # do something and return $/ (foo is always something) end while line = gets # change $/ foo = line.chomp # do something and return $/ (most of all, beware, foo might be nil) end For symmetry, while I can't say I see need for it, maybe we should have String.chomped (and it's chop, !, and Kernel variations) returning the part which has been removed. - Aleksi