From: Daniel DeLorme Date: 2007-03-01T10:41:56+09:00 Subject: Re: Parsing a file with look ahead Gregory Brown wrote: > On 2/21/07, S. Robert James wrote: >> Thanks! BTW, looking at the Rdoc, it seems each_cons is what I want, >> no? > > If you are dealing with paired lines, use enum_slice(2) > > if you are dealing with data dependent on the current and previous > line, use each_cons, yes. Except each_cons(n) will iterate 9 times if you have 10 lines. Maybe something simple like this? line = f.gets while line nextline = f.gets #do stuff... line = nextline end Daniel