From: raja@... (Raja S.) Date: 2001-01-18T02:10:01+09:00 Subject: [ruby-talk:9460] reading an entire file as a string [This is something i've been wanting to ask for a while.] What is the reason we only have IO.readlines and not IO.read? Is File.new("data").read then the recommended way of reading the entire contents of a file as a string? Unlike the IO methods this does not automatically close the file object. The resultant file object is closed when garbage collected. I was wondering if before the GC happens, whether lingering file objects would cause the maximum number of allowed open files per process to be exceeded. Ran File.new on a bunch of unique files in a tight loop and interestingly ruby seems to kick in the GC when it fails to get a file handle from the OS ? Raja