From: Stefano Crocco Date: 2008-04-07T20:40:38+09:00 Subject: Re: strange, non-repetitious error On Monday 07 April 2008, Pan Kracy wrote: > I don't use "lines.each do |line|" because I need number of line. Do you know about Array#each_index and Array#each_with_index?: ['a', 'b', 'c'].each_index{|i| puts i} Output: 0 1 2 ['a', 'b', 'c'].each_with_index{|obj, i| puts "i: #{i}, obj: #{obj}"} Output: i: 0, obj: a i: 1, obj: b i: 2, obj: c Stefano