From: Joel Pearson Date: 2013-01-31T21:09:26+09:00 Subject: Re: Select "columns" from multidimensional array? Documenting the end result. I added a sort to keep the input column order, and reordered the inputs to make the array itself optional for ease-of-use within the parent class. def get_cols( headers, multi_array=nil) multi_array = @data if multi_array.nil? multi_array.transpose.select { |header,_| headers.include?(header) }.sort_by { |header,_| headers.index(header) || headers.length }.transpose end irb(main):017:0> get_cols %w(A3 A1), a => [["A3", "A1"], ["B3", "B1"], ["C3", "C1"]] -- Posted via http://www.ruby-forum.com/.