From: "Sci000 Lem." Date: 2006-07-21T19:25:07+09:00 Subject: Re: recursive method and references > Your pos array contains references to other arrays, > and pos.dup is a shallow copy, thus pos2 contains refs > to the same sub-arrays as pos. Any changes made via > access to pos2 affects the same sub-arrays as viewed > from pos. > > Clear as mud? 9^) > > Cheers > Chris Thank you for the answer, I didn’t know that the subarrays in Ruby are just referenced to the whole array, so I was wondering why it don’t work (normally I solve this kind of problems in Mercury, and that’s completely different) I rewrote the lines which built pos as following: arr.length.times{arr[0].length.times{pos.push(0)}} and everything works properly! -- Posted via http://www.ruby-forum.com/.