From: Reese Chappuis Date: 2011-11-13T11:42:41+09:00 Subject: Re: Using gets and split --e89a8f3ba85d2191a104b194b5ff Content-Type: text/plain; charset=ISO-8859-1 Ok, that does work- so the problem is with how the data is being inputted, not with the program? On Sat, Nov 12, 2011 at 9:12 PM, jake kaiden wrote: > hi Reese, > > > all_input = gets > > all_input = all_input.to_s.split("\n") > > the #to_s method is unnecessary here, as #gets returns a String > already > > if you're splitting on new lines ("\n"), everything you get with > `gets` will be in one element of the array, as there is only one new > line... similarly, if you change the string to be "soandsoandsoandso," > it will still wind up as only one element of the array, as there is only > one new line... > > for comparison, try: > > str = "soandsoandso" > arr = str.split("o") > > p arr > > => ["s", "ands", "ands"] > > - j > > -- > Posted via http://www.ruby-forum.com/. > > -- Reese Chappuis --e89a8f3ba85d2191a104b194b5ff--