From: bc90141 Date: 2006-05-23T23:28:23+09:00 Subject: Read File Into An Array 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| } However, it seems to put the whole file into the array as one item. If I try and use contentsArray.slice! I get: undefined method 'slice!' for # (NoMethodError) So it sees the contents of the array as a file instead of a list of text lines as I want. What am I doing wrong? Thanks in advance. -- Posted via http://www.ruby-forum.com/.