From: Pan Kracy Date: 2008-04-07T20:33:27+09:00 Subject: Re: strange, non-repetitious error I don't use "lines.each do |line|" because I need number of line. This is the code: File.open(procsw[j-1],'r+') do |file| lines = file.readlines for z in 1..lines.length line = lines[z-1] #can't convert false into integer if(line!=nil and line!="") then line.downcase.gsub("external name") do if(line.index(/'.*'/)!=nil) then line.gsub(/'.*'/) {|match| k = match.rindex("/") line = "'" + bladePath + match.slice(k..match.length) + "\n" } else lines[z].gsub(/'.*'/) {|match| k = match.rindex("/") lines[z] = "'" + bladePath + match.slice(k..match.length) + "\n" } end end end end file.pos = 0 file.print lines file.truncate(file.pos) file.close end -- Posted via http://www.ruby-forum.com/.