From: daz Date: 2005-07-08T18:00:47+09:00 Subject: Re: accessing index inside map Pe�a, Botp wrote: > [...] i cannot find something like array#each_with_index... David Black was once President of Citizens for MWI, Inc. (google "map with index" MWI). Welcome! You can add your own, of course. module Enumerable def map_with_index! each_with_index do |e, ix| self[ix] = yield e, ix end self end end arr = (1..6).to_a arr.map_with_index! do |e, ix| [2, 5].include?(ix) ? e : e*2 end p arr #=> [2, 4, 3, 8, 10, 6] daz