From: 7stud -- Date: 2011-04-08T03:34:27+09:00 Subject: Re: newlines in array problem each() doesn't create a new array. Why not use map()? And you need to be careful using delete!() because it will change the strings in the original array too. array = ["hel\nlo", "bl\nah"] new_arr = array.map do |str| str.delete!("\n") end p new_arr p array --output:-- ["hello", "blah"] ["hello", "blah"] If you really want to preserve the original array, don't use delete! on the strings. On the other hand, if you don't need two versions of the array hanging around in memory, then use all ! methods: array = ["hel\nlo", "bl\nah"] array.map! do |str| str.delete!("\n") end p array --output:-- ["hello", "blah"] -- Posted via http://www.ruby-forum.com/.