From: Derek Smith Date: 2009-08-17T11:03:08+09:00 Subject: while !file.eof? How can I use a while loop in such as way where I want to process the file until EOF? thank you! Here is my code: mailog="/tmp/maillog" last_record="Jul 15 22:09:10" File.open(mailog, 'r+').each { |line| while !mailog.eof? if line =~ /^#{last_record}/o p line end end } mail.scr:6: undefined method `eof?' for "/tmp/maillog":String (NoMethodError) from mail.scr:5:in `each' from mail.scr:5 -- Posted via http://www.ruby-forum.com/.