On May 23, 2006, at 5:43 PM, Robert Klemme wrote:

> Why do you settly with a complicated version?  IO.readlines() will
> perfectly suit your needs.  If you want to do it while iterating
> yourself you should at least use the block form of File.open().

or IO::foreach:

IO.foreach("somefile") do |line|
   ...
end

anonymous ruby-forum user wrote:
> That did it - thanks!  :-)

f = open("somefile")
contents_array = []
f.each_line { |line| contents_array << line }
f.close

or:

contents_array = IO.readlines("somefile")

Which looks better?

-- Daniel