Thiel Chang wrote in post #1062600:
> Anyhow, I solved the problem by refactoring  the code.
>
> I  have introduced a Code class for the code-array and now I can put the
> code objects in the arr-array.

This is certainly a good idea. Whenever you have multiple arrays with 
the same specific structure, you should use an object/Struct instead.

However, you could solve the original problem simply by duplicating the 
array:

#---------------
# this doesn't work:
container = []
a = [1, 2]
container << a
a[0] = 10
container << a
p container

# this does:
container = []
a = [1, 2]
container << a
b = a.dup
b[0] = 10
container << b
p container
#---------------

-- 
Posted via http://www.ruby-forum.com/.