From: brabuhr@... Date: 2010-07-10T04:25:37+09:00 Subject: Re: FIRST PROGRAMMING PROBLEM Array On Fri, Jul 9, 2010 at 2:01 PM, Francisco Martinez wrote: > it reads the wole text not considering each word or "." but reading each > line...I need to put it in a method that calls "text.txt" and to use an > array and the result must be each line one word. Assuming you had a method that printed each line of the file like: f=File.open(txtFile) f.each do |line| puts line end f.close On Fri, Jul 9, 2010 at 1:31 PM, Alex Stahl wrote: > You can put individual elements into the array w/ the push operator > "<<": myArray << "someTxt" (One way that) You could modify it to put each line in an array like: a = [] f=File.open(txtFile) f.each do |line| a << line end f.close Of course, in your case you would want to extract the tokens from the line and stick them in the array instead.