From: Robert Klemme Date: 2006-08-26T07:25:10+09:00 Subject: Re: No speedup...! Karl von Laudermann wrote: > Oliver Bandel wrote: > I think what you wanted to do is use ARGV.each instead of ARGF.each, to > iterate over the list of file names, and pass each file name into the > look_for_begin function. Within the function, you'd process only the > lines in that file. In other words, like this: > > def look_for_begin(fn) > IO.foreach(fn) do |line| > if line =~ /^begin/ > puts line > return > end > end > end > > ARGV.each {|fn| look_for_begin(fn) } I think, Oliver wanted to iterate all lines in the files whose names were given as command line arguments. Something like: ARGF.each do |line| if line =~ /^begin/ puts line break end end Kind regards robert