From: Xavier Noria Date: 2006-11-07T22:24:36+09:00 Subject: Re: dividing an array On Nov 7, 2006, at 2:14 PM, Brad Tilley wrote: > Say I have an array that contains 144 strings. I want to divide the > array into > 12 sub-arrays each containing 12 strings. What is the Ruby Way of > doing this? > I've looked at slice array[0..11] etc, but that seems a bit clunky. If those are the 12 natural consecutive sub-arrays: require 'enumerator' array.each_slice(12) do |x| # ... end -- fxn