From: Joel VanderWerf Date: 2003-06-12T23:05:05+09:00 Subject: Re: does each work on a copy? Rasputin wrote: > This has me confused (It's getting to be a frequent experience). > > ----------------8<---------------- > > SPACE = 1 > > a = Array.new(5) > b = Array.new(5, SPACE) > > a.each { |el| > el = SPACE 'el' is a local variable which is bound to successive elements of the array. When you assign to el, you change the binding of the local variable, without touching the array or the element itself. What you may want here is map!: a.map! { |el| SPACE } This replaces each element of the array with SPACE.