From: 7stud -- Date: 2011-04-28T09:50:58+09:00 Subject: Re: File position and buffers This shows the output better: e = input.enum_for(:each) #You can do this for a File too. e.each_slice(2) do |buffer1, buffer2| puts "buffer1: #{buffer1.inspect}" puts "buffer2: #{buffer2.inspect}" puts "-" * 10 end --output:-- buffer1: ">entry1\n11111111111\n\n" buffer2: ">entry2\n22222222222\n\n" ---------- buffer1: ">entry3\n33333333333\n" buffer2: nil ---------- Before doing the sub() on buffer2, you will have to check if its nil: if buffer2.nil? #don't do a sub() else #do the sub() end -- Posted via http://www.ruby-forum.com/.