From: bc90141 Date: 2006-05-23T23:39:07+09:00 Subject: Re: Read File Into An Array Madan Manoharan wrote: > On 5/23/06, bc90141 wrote: >> Hi, >> >> I want to read a file into an array. I'm using the following code: >> >> contentsArray = Array.new >> >> f = File.open("filenamehere") or die "Unable to open file..." >> contentsArray = filenamehere.each_line { |line| } >> > > try: > > contentsArray = f.each_line {|line|} > > instead. Sorry... I typed that into the forum incorrectly. I actually have f.each_line, and it still sees it as a file in the array and not the individual lines. -- Posted via http://www.ruby-forum.com/.