2009/8/17 botp <botpena / gmail.com>:
> On Mon, Aug 17, 2009 at 10:03 AM, Derek
> Smith<derekbellnersmith / yahoo.com> wrote:
>> How can I use a while loop in such as way where I want to process the
>> file until EOF?
>
> on your case, you do not need the EOF sig. Pls read on ruby's
> iterators and File.
>
>>....
>> File.open(mailog, 'r+').each { |line|
>>  ¨Âèéìå ¡íáéìïç®åïæ¿
>>  ¨Âìéîå ½þ ¯Þ£ûìáóôßòåãïòäý¯ï
>>  ¨Â ìéîå
>>  ¨Âîä
>>  ¨Âîä
>> }
>
>
> try eg,
>
> File.open( "maillog" ).each do |line|
>  ¨Â ìéîå éæ ìéîå ½þ ¯Þ£ûìáóôßòåãïòäý> end

You're not closing the file handle properly. :-)

Better:

File.foreach "maillog" do |line|
  p line if /^#{last_record}/o =~ line
end

Kind regards

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/