From: oinkoink Date: 2007-02-09T09:05:09+09:00 Subject: Re: Iterators and blocks question On Feb 8, 3:25 pm, "oinkoink" wrote: > require 'mathn' > width = (Math.log((rl = IO.readlines("test.txt")).length)/ > Math.log(10)).floor + 1 > rl.each_with_index{ |line, k| print "%#{width}d. " % k + line} Following up to myself, the idea is to keep from indenting the lines differently every time the line number passes a power of 10. Regards, Bret