From: Alex Stahl Date: 2010-07-10T02:31:49+09:00 Subject: Re: FIRST PROGRAMMING PROBLEM Array You can put individual elements into the array w/ the push operator "<<": myArray << "someTxt" Then, if you want to print each value in the array, you would use the .each iterator: myArray.each do |item| puts item end Between these two, you should be able to easily add the supporting code you'll need to get your results. -Alex On Fri, 2010-07-09 at 12:22 -0500, Francisco Martinez wrote: > Hi...I'm trying to solve a very simple exercise but this is one of my > first tasks and I can't manage to find a solution. > I have a txt file and I have to write a method which; given the txt file > as an entry argument returns an array of tokens. I have to call the > method that prints the solutin in the screen. > The solution should be this type: > > token 1= The > token 2= man > token 3= was > > > The starting txt file is a normal text...the only thing is that each > word or diacritic simbol is separated from a space to the other one. I > suppose I have to solve the problem with a regular expression but for > example I don't know how to punt words in the array and how to put them > one per line as the solution shows. > Some suggestion???? > Thanks