From: 7stud -- Date: 2011-07-20T13:20:01+09:00 Subject: Re: Splitting strings lines = [ 'the brown fox jumped,', 'over the fence,' ] results = [] lines.each do |line| line.chomp!(',') words = line.split(' ') print "words: " p words words.inject('') do |accumulator, word| accumulator << "#{word} " results << "#{accumulator.chomp(' ')}," accumulator end end puts results --output:-- the, the brown, the brown fox, the brown fox jumped, over, over the, over the fence, -- Posted via http://www.ruby-forum.com/.