Tomas Fischer wrote: > Hi, > > I've got an array a= [1,2,3,4,5,6] and want to access each second > element: > b=[2,4,6]. How is this done in ruby? > > I know, that I can use a for-loob and modulo operator, but I think there > is a "ruby way" of doing this. > > Thanks. > tomas I've always been intrigued by creating a generalized enumeration system. Have you guys seen this: http://www.rubyweeklynews.org/20050710 : accessing index inside map. For example: (1..10).collect.with_index { |v, i| v * i } I think that is sweet! I wonder if it can be generalized enough to do this: file.collect.each_byte.with_index { |b, i| b + 1 } Mike