From: "Peña, Botp" Date: 2002-11-30T16:55:30+09:00 Subject: Re: loop starting not from beginning Hi sir Nobu (aka nobu.nokada@softhome.net [mailto:nobu.nokada@softhome.net]): You wrote: > > Do you want to write like as: > Fp("input.txt", 4) {|line| p line} > ? > > > def Fp (file,skip) > > File.open(file) do |f| > > skip.times {f.readline} > > f.each { |line| p line } > f.each { |line| yield line } > > end > > end This is neat. Very Ruby, imho. > Or > > def Fp(file, skip, &block) > File.open(file) do |f| > skip.times {f.readline} > f.each(&block) > end > end this looks like what I did... it also looks like the above... see: def Fp2 (file, skip, &procarg) File.open(file) do |f| skip.times {f.readline} f.each {|line| procarg.call(line)} end end Anyway, it looks "dirty" maybe because of &/call... I need more practice :-) > Nobu Nakada Many thanks again. Best regards, -botp