From: 7stud -- Date: 2008-03-07T07:37:33+09:00 Subject: Re: IO#Foreach -- Max line length Tristin Davis wrote: > I'm trying to emulate the new feature in 1.9 that allows you to specify > the maximum length of a line read in Ruby 1.8.6. Can anyone help? max = 3 count = 0 IO.foreach('data.txt') do |line| if count == max break else count += 1 end puts line end -- Posted via http://www.ruby-forum.com/.