"Jesús Gabriel y Galán" <jgabrielygalan / gmail.com> wrote in post 1026892: > On Sun, Oct 16, 2011 at 7:15 PM, teresa nuagen > <s-unguyen2 / huskers.unl.edu> wrote: >>>> from last line to first. >>> words. >>> >>> Let us know how you progress. >> How would I go about it, using the three programs described above. I >> will try to follow your example with a longer poem of my own. Thanks >> again for your help! I appreciate it! > > I guess, looking at the problem description, that you are learning > Ruby and/or programming, and that this is some kind of exercise. So it > would be wrong for me to give you a solution, since the purpose of an > excercise is to learn by trying. Let us see what you have tried. Ruby > has an interactive shell (irb) where you can try how all the functions > work, so you can learn by trying and then apply that knowledge to the > problem at hand. I recommend you take a look at these two pages: > > http://www.ruby-doc.org/core/String.html > http://www.ruby-doc.org/core/Array.html > > and get familiar with the methods in the Array and String classes. > This will help you solve many problems. In this specific case, I think > you can solve your problem using String#split, Array#reverse and > String#reverse. You will also need to know how to iterate an array: > > array = [1,2,3,4,5] > array.each do |element| > puts element > end > > will print > 1 > 2 > 3 > 4 > 5 > > With this knowledge and reading carefully the documentation of split > and reverse, I think you can manage to solve the problem. If you have > any specific question about methods or you get blocked by something > you don't understand, let us know. > > Good luck ! > > Jesus. alright thanks for your advice and tips. I'm familiarizing myself with tring and the order of words. Is array applied in this problem or i'm I nly focusing on string? Can I have the poem in ruby and then change the order using separate rograms or do I have to open the file through nano first and then in uby? If so how do I open a nano file using ruby? My current file is nano poem" to open it in ruby do I have to change it into a ".txt" ile. How would I do that?