From: Mk 27 Date: 2009-06-02T08:06:22+09:00 Subject: counting .each Is there some equivalent to file.lineno when using array.each? Eg, if I am iterating thru an array of strings searching for a pattern, and I want to save the current array index, do I have to do this: count = 0 array.each { |e| finds.push count if e =~ /pattern/ count += 1 } or is there a "array.currentindex"? I guess I could use each_index... -- Posted via http://www.ruby-forum.com/.