On Mon, 26 Jun 2006, Dark Ambient wrote:

> Is there a way to set the indice on an array,
> i.e.
>
> Instead of:
>
> myarray = [1,2,3,4,5]
> myarray[1] =2
> myarray[4]=5
>
> myarray[A]=1
>
> I know this can be done using hashes but was not sure with arrays
>
> Stuart

   harp:~ > cat a.rb
   # gem install arrayfields
   require 'rubygems'
   require 'arrayfields'

   myarray = [1,2,3,4,5]
   myarray.fields = ['A','B','C','D','E']

   p myarray['A']


   harp:~ > ruby a.rb
   1

-a
-- 
suffering increases your inner strength.  also, the wishing for suffering
makes the suffering disappear.
- h.h. the 14th dali lama