From: w_a_x_man Date: 2010-10-27T19:50:22+09:00 Subject: Re: Extraction of single subarrays from multidimensional array On Oct 27, 5:14 am, Maurizio Cirilli wrote: > OK, so  looks like there is no way with Ruby to extract > single subarrays from md-arrays with unknown dimensions. > > Thanks all for help. > > -- Maurizio If you don't know the length of ss when you write your program, then obviously you don't know how many variables to use in your assignment statement. You don't know whether to say a,b,c = ss or a,b,c,d = ss or a,b,c,d,e = ss However, those variables are not needed at all. To extract the first subarray, say ss[0] or ss.first. To extract the last subarray, say ss[-1] or ss.last. To extract each in turn along with its index: ss.each_with_index{|x,i| p i, x} 0 ["tcg", "agt", "tct", "agc", "tca", "tcc"] 1 ["aaa", "aag"] 2 ["ctg", "tta", "ctt", "cta", "ctc", "ttg"] All of this will become obvious after you have some programming experience.