Re: getting the next line with the iterator

while g.next?
if g.next =~ /regExp/
3.times { list << g.next }
end
end
end
puts list

Well, yes. In the general case I would agree.
In this case I think

list = []
File.open(‘toto.txt’, ‘rb’) do |myFile|
while line = myFile.gets do
3.times {list << myFile.gets} if line =~ /regExp/
end
end
puts list

is totally sufficient.

cheers

Simon