From: Ben Bleything Date: 2010-05-16T06:34:20+09:00 Subject: Re: chomp like Perl operator in Ruby On Sat, May 15, 2010 at 2:26 PM, Parag Kalra wrote: > Is there a chomp like Perl operator in Ruby using which I can literally > remove new line characters as show below in my Perl script: There's a really easy way to answer this question for yourself: $ ri chomp (from ruby core) Implementation from String ------------------------------------------------------------------------------ str.chomp(separator=$/) => new_str ------------------------------------------------------------------------------ Returns a new String with the given record separator removed from the end of str (if present). If $/ has not been changed from the default Ruby record separator, then chomp also removes carriage return characters (that is it will remove n, r, and r\n).