Paul Lutus wrote: > Xan Xann wrote: > > / ... > >>> temp.txt = "This is a test line." >> >> result = data.gsub(/#{find}/,replace) >> File.open(dest,"w") { |f| f.write(result) } if data != result >> end >> >> substitute(f1,f2,"ol","ur") >> >> >> What happens? > > Here is my example call to 'substitute': > > substitute("temp.txt","result.txt","i","x") > > You can see that I use strings containing the names of the files. > > Here is your example call to 'substitute': > > f1 = File.open("original.txt") > f2 = File.open("canviada.txt") > > substitute(f1,f2,"ol","ur") > > You are using open file handles instead of strings. The remedy is, > instead > of using your example of my example, use my example. Yes, sorry. What stupid error!!! Thanks, Xan. -- Posted via http://www.ruby-forum.com/.