Charles L. Snyder wrote:

>- the general method of
>array.each do {|e| e.gsub(pattern, replacement)} doesn't work?
>  
>

Because you first substitute and then throw away the result.

You can either create a new array with

new_array = array.map { |e| e.gsub(pattern, replacement) }

or substitute the strings in place with

array.each { |e| e.gsub!(pattern, replacement) }

You can do the same to the array of course:

array.map! { |e| e.gsub(pattern, replacement) }

But be careful, if you use !-methods, they can have unintended consequences.

-- 
Florian Frank