From: "Jesse B." Date: 2010-04-05T06:37:44+09:00 Subject: Re: change in number of leading spaces Robert, Thank you for taking the time to write back. I got the initial file operations you gave me working like so: File.open("output.txt", "w") do |outfile| File.foreach "input.txt" do |line| puts line outfile.write line end end which both displays the results on the command line and in the output.txt file then I tried to add in the rest like so File.open("output.txt", "w") do |outfile| File.foreach "input.txt" do |line| def count_leading_spaces(s) s[/\A */].length # or any other method that works end sp = 0 ARGF.each_line do |line| i = count_leading_spaces line if i != sp line.chomp! # avoid duplicate \n printf "Change from %2d to %2d spaces in this line %4d: %s\n", sp, i, ARGF.lineno, line sp = i end end #puts line #outfile.write line end end and when I save as a ruby file and run from the command line nothing happens, until i hit control-c and get a list of errors. I think the problem is that I am incorrectly assembling your snippets. Would it be possible to redo this as a complete example that works as a ruby file run from the command line? thank you in advance -- Posted via http://www.ruby-forum.com/.