From: "Peña, Botp" Date: 2008-06-28T12:45:18+09:00 Subject: Re: File question From: tekmc@hotmail.com [mailto:tekmc@hotmail.com] # t=Time.new # e=false ok #if(File.size('ManageLists_Changelog.txt')==0) # e=true # end i would prefer, e = File.size('ManageLists_Changelog.txt')==0 # # File.open('ManageLists_Changelog.txt', 'r').each do |c| # if(c=="__#{t.month}/#{t.mday}/#{t.year} \(#{t.zone}\)") # puts "TESTING" # e=true # end # end hmmm, if e is already true, why would i let it go through that code wc just sets it to true again?? maybe, you wanted test e first like, if not e File.open('ManageLists_Changelog.txt', 'r').each do |c| if c=="__#{t.month}/#{t.mday}/#{t.year} \(#{t.zone}\)" e=true end end end (note, i'm just following the logic of your code) now, when comparing strings, string#size usually catches the diff. and when debugging/printing values, it would be better if you use #p instead of #puts since #p quotes the whole string expression and displays invisible characters too (by escaping them w a backslash on display) eg, p "asdf\n\t" =>"asdf\n\t" vs. puts "asdf\n\t" =>asdf print "asdf\n\t" asdf #=> nil ergo, i would then do my test loop like, File.open('ManageLists_Changelog.txt', 'r').each do |c| d="__#{t.month}/#{t.mday}/#{t.year} \(#{t.zone}\)" p c p d p c == d end hth. kind regards -botp