"Martin Julian DeMello" <mdemello / kennel.ruf.rice.edu> wrote in message
news:9ekcd7$jj0$1 / joe.rice.edu...
> I'm trying to write an each! iterator that will iterate over an object
> (specifically, an array) and pass a modifiable reference to its contents,
so
> I can say something like
>
>   a=[1,2,3,4,5]
>   a.each! { |i| i++ } # [2,3,4,5,6]
>
> Is this possible? Already existing? Possible, but ugly? 'RTFM' is fine, as
> long as you tell me which FM to R :)
>

Why don't you use map!

a.map! {|i| i+1}

Park Hee-Sob