From: Seebs Date: 2009-12-29T15:05:14+09:00 Subject: Re: PLEASE HELP...dup is not working correctly in the following code On 2009-12-29, timr wrote: > However, unlike the irb session, the following code shows that > modification of the dupped object is somehow changing the original. No, it isn't. You have two separate arrays. However, each of those arrays contains the same strings -- the first string of each array is the same object. You want a deep copy (where you duplicate all the objects in the array, not just the arrays). Something like: @maze_dup = @maze.map { |x| x.dup } ... I think. -s -- Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam@seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!