From: Gary Watson Date: 2010-09-18T04:25:33+09:00 Subject: Re: search and replace John Smith wrote: > Hi everyone, > > I want to be able to run a program that will do a bunch > of searches specified in an array of strings, and replace the > first occurrence of those strings with strings specified on a > second array for a given text file. > > What would be the best way to do this? > > Ted. try (["one", "two", "three", "four"].zip ["crazy", "monkeys", "go", "to", "school"]).collect {|tuple| tuple[0].gsub("o", tuple[1])}. -- Posted via http://www.ruby-forum.com/.