On Aug 26, 2006, at 4:11 AM, dblack / wobblini.net wrote: > On Sat, 26 Aug 2006, William James wrote: >> Oliver Bandel wrote: >>> ==================================== >>> def look_for_begin >>> while line = gets >>> if line =~ /^begin/ >>> puts line >>> # return >>> end >>> end >>> end >>> >>> ARGF.each { look_for_begin } >>> ==================================== >> >> puts ARGV.map{|f|IO.readlines(f).find{|s|s=~/^begin/}} > > Or maybe: > > puts ARGF.find {|s| /^begin/.match(s) } No, don't use match, it is slow: [ruby-talk:204747] -- Eric Hodel - drbrain / segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com