From: Peter Hickman Date: 2011-04-05T19:59:23+09:00 Subject: Re: Separate new lines from an output On 5 April 2011 11:38, Leo M. wrote: > Sorry for being imprecise. > > The matter is this : I have 87 files named black1, black2 ...... black > 87. > > I want ruby to print each file with the entire path, so, this is what > I've written : > > i = 1..87 > > array = [] > > e = i.each {|i| puts ("/R/blackout/black"+i.to_s+"\n")} e at this point is an array > > array.push e You have pushed an array (e) to be the first element of the array (array). > > puts array.size # => 1 So this is correct. You might want to try i = 1..87 array = i.map {|i| "/R/blackout/black"+i.to_s} puts array.size # => 87 > > ruby actually prints correctly each line, but as a single array object. > > I need that each line, each path printed is a single array object, so > that in the end I'll have an array of 87 as size with : > > "/R/blackout/black1" > "/R/blackout/black2" > ... > "/R/blackout/black87" > > I also tried the .chomp method but is pretty much the same :-\ > > -- > Posted via http://www.ruby-forum.com/. > >