Hugh Sasse Staff Elec Eng <hgs / dmu.ac.uk> writes: > How do the getopt libraries interact with ARGF? I know they can remove > things from ARGV, but will this mean that ARGF is affected at the same > time? I'm not sure from the information I have found. ARGF used ARGV whenever it needs to: it is evaluated lazily. What this means is that whenever you do a gets, ARGF says "do I have a file to read from?" If not, it picks the next thing off ARGV and uses it. For example, here's som code that skips a file in the middle of ARGV. File.open("_f1", "w") {|f| f.puts "f1" } File.open("_f2", "w") {|f| f.puts "f2" } ARGV.shift while ARGV.length > 0 ARGV << "_f1" << "gumby" << "_f2" puts gets ARGV.shift # skip gumby puts gets And here it is again, changing the name of the next fil to open just before it opens it. File.open("_f1", "w") {|f| f.puts "f1" } File.open("_f2", "w") {|f| f.puts "f2" } ARGV.shift while ARGV.length > 0 ARGV << "_f1" << "gumby" puts gets ARGV.shift # skip gumby ARGV << "_f2" puts gets Hope this helps. Dave