dblack / candle.superlink.net wrote in message news:<Pine.LNX.4.44.0301170722590.17053-100000 / candle.superlink.net>...
> Also, I think you're doing it backwards :-)  For one
> thing, if you've got duplicate values in your array, your hash will
> end up truncated.  Also, I think an indexed #to_h sort of grows out of
> the idea that an array is, or can be viewed as, a hash whose keys
> happen to be positive integers.  That means that you'd want the
> indices to be the *keys* of the new hash, not the values.

The code I posted does use the indicies as the keys:

irb(main):014:0> h = [:a, :b, :c].to_h
=> {0=>:a, 1=>:b, 2=>:c}
irb(main):015:0> h.keys
=> [0, 1, 2]

Glad we're otherwise in agreement :-)

Tom