From: ts Date: 2001-10-23T21:22:46+09:00 Subject: [ruby-talk:23043] Re: chop and chomp >>>>> "A" == Alan Moore writes: A> I notice that String#chop is a little more intelligent A> than its Perl equivalent, in that, if the last character A> of the string is "\n", it checks whether the next-to-last A> character is "\r" and, if so, chops them both off. This chop is defined as http://www.ruby-lang.org/en/man-1.4/String.html#chop Chops off the last character of the string (2 characters if the last characters are "\r\n"). A> separators used by different OS's. What I'm wondering is, A> why doesn't String#chomp work the same way? chomp([rs]) chomp!([rs]) Chops off the line ending of the string, which is specified by the rs. The default value of the rs is the value of the variable $/. You can specify `rs' for #chomp, $/ is just the default value Guy Decoux