From: Aaron Patterson Date: 2007-01-23T03:25:44+09:00 Subject: Re: Silly Array Question On Tue, Jan 23, 2007 at 03:17:36AM +0900, Mike Keller wrote: > This will probably be a silly question, but I've been searching for > quite awhile now and have been unable to locate how to do this. > > I have two arrays which come from two different files. One is a CSV > file and the other just a list in a text document. > > What I want to do is this. > Take the csv doc. > 123 > 123 > 123 > 123 > > And the text file. > 4 > 4 > 4 > 4 > > Then turn it into one array that looks like. > 1234 > 1234 > 1234 > 1234 > > Maybe I've just been reading the stuff I've been finding on ruby-doc > wrong/not making the connection ( I have had a cold ) but any help that > could be provided would be appreciated. You could try doing a zip with a map: a = %w{ 123 123 123 123 } b = %w{ 4 4 4 4 } a.zip(b).map { |x,y| "#{x}#{y}" } # => ["1234", "1234", "1234", "1234"] -- Aaron Patterson http://tenderlovemaking.com/