From: Dave Thomas Date: 2001-04-25T01:28:36+09:00 Subject: [ruby-talk:14162] Re: Can I insert into an array Jim Freeze writes: > Ok, this may be a dumb question, but, is it possible to insert into an > array. > > EG, > a = [1, 2] > a.insert(1,3) => [1,3,2] a = [1, 2] # => [1, 2] a[1,0] = 3 # => [1, 3, 2] In general, a[pos, len] = x deletes 'len' elements starting at 'pos', then inserts 'x' at that position. If 'len' is zero, nothing gets deleted before the insert. Dave