From: Navindra Umanee Date: 2005-01-24T00:59:07+09:00 Subject: Re: File.read not returning nil [newbie] Tim Heaney wrote: > It doesn't for me. I get the empty string both times. But why? I guess that's better than being inconsistent. nil would have been nicer, IMHO. Do you know if there is a way to make "" equivalent to nil? I guess I could try messing around with the NilClass. Just so that I'm clear. You tried this: File.open("/dev/null") { |file| print "file.read should return nil\n" if file.eof? print "file.read: " print file.read print "\n" } and got it to print the empty string? > $ ruby -e 'p IO.read("/dev/null")' > "" Same here. Thanks, Navin.