From: Hal Fulton Date: 2005-08-29T10:55:53+09:00 Subject: Re: [Q] how to unflatten a flat-array SHIGETOMI, Takuhiko wrote: > dear guys, > > i am seeking a smart way to do ... > > [ 1, 2, 3, 4, 5, 6, ... ] => [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ], ... ] > > especialy, the way hopefully will work safety when the source array's > size is odd or zero. > I have used something like: arr = array.dup result = [] while ! arr.empty? result << arr.slice!(0..1) end Would that work for you? Hal