From: Kristof Bastiaensen Date: 2004-09-03T05:15:25+09:00 Subject: Re: autochomp? Hi, On Thu, 02 Sep 2004 19:18:10 +0200, Robert Klemme wrote: > > "Martin DeMello" schrieb im Newsbeitrag > news:idIZc.301315$J06.4478@pd7tw2no... >> [quoted text muted] > > Not AFAIK. You can do > > content = IO.readlines(file).each {|l| l.chomp!} > > or (more efficient) > > content = File.open(file) {|io| io.inject([]) {|ar,line| line.chomp!; ar > << line} } > I think in this case the first is more efficient than the second. Since chomp! modifies the object inplace, no object gets created. Regards, Kristof > But I guess you figured that yourself already. > > Kind regards > > robert