From: Harry Date: 2007-03-20T20:46:45+09:00 Subject: Re: array to hash On 3/20/07, Servando Garcia wrote: > > Hello all > Is there a method to collect the items in an array into a hash > > I want to go from this X =[1,2,3,4,5,6] to this Y={1 =>2, 3 =>4, 5 =>6} > > Just seems like there should be one > > Thanks in advance > > Sam Try this arr = [1,2,3,4,5,6] ahash = Hash[*arr] p arr p ahash Harry -- http://www.kakueki.com/ruby/list.html Japanese Ruby List Subjects in English