From: Phlip Date: 2003-01-01T01:03:09+09:00 Subject: Re: Newbie Questions Array Eric-Roger Bruecklmeier wrote: > I have detected a strange behavior is ruby: > > foo1 = [1,2,3,4,5,6,7,8] > foo2 = ["a","b","c"] > > foo1[3,0] = foo2 > > what i would expect: > > foo1 => [1,2,3,["a","b","c"],4,5,6,7,8] > > what ruby does: > > foo1 => [1,2,3,"a","b","c",4,5,6,7,8] > > is this intentional or a bug? > > to realize what i would expect, i use this "trick": > > foo1[3,0] = something > foo1[3] = foo2 > > now foo1 is: [1,2,3,["a","b","c"],4,5,6,7,8] > > Any suggestions? BASIC does the same trick with MID(s$, a, b) = c$. It's by design. The trick exists so you can replace the middle of a string efficiently. -- Phlip http://www.greencheese.org/AndNowaNitelyLitelyUrbanOne -- Temporomandibular joint disorder keeping the neighbors awake again? --