From: Michael Tomer Date: 2008-11-22T03:10:46+09:00 Subject: Re: 2 dimensional array to single arrays John Butler wrote: > Hi, > > I have a nasty loop which creates 2 single arrays from a 2 dimensional > array, > > is there a quicker way to do it? > > [["a",1],["b",2],["c",3]] > > So i want an array > ["a","b","c"] > > and > > [1,2,3] > > Any quick method to do this? > > JB my_array = [["a",1],["b",2],["c",3]] letters = my_array.collect {|array| array[0]} numbers = my_array.collect {|array| array[1]} -- Posted via http://www.ruby-forum.com/.