From: Jeremy Bopp Date: 2010-10-27T01:11:55+09:00 Subject: Re: Extraction of single subarrays from multidimensional array On 10/26/2010 11:05 AM, Maurizio Cirilli wrote: > Thank you all for the very very instructive replies- > I have the very last question: how to make this iteration > through splat operator general i.e. flexible covering cases > in which the number of subarrays (a,b,c) in the above example > is unknown? I mean, the splatter operator, doing iteration > automatically, > does not return any count on the columns of the ss input m-array so > how to know > how many variables to put on the left side of the assignment > a, b, c = *ss ? > > Maybe such question is trivial but not for me: I spent several hours > thinking about that and still I have no clue how to do that (the hard > life > of the beginners!!) :-) It is not possible to do what you're proposing. If you just want to iterate over the array contents, us the each method of the array object: ss.each do |item| # Do something with the item here. end -Jeremy