From: "Mehr, Assaph (Assaph)" Date: 2004-09-06T09:14:37+09:00 Subject: Re: nuby question > Thanks for responding. namelist is just a list of words that I was > then going to sort. I realize Ruby has a sort method for arrays that > takes care of this very easily, (took me about half a second to figure > that out and get it to work, but I was just trying to hand code it to > get more familiar with the language. Sure it's nothing I would ever > use again, but I find the more I keep working with a language the > quicker I begin to grasp it and can begin to do something useful with > it. Not sure if the each_with_index method would help me here, but it > seems apparent that I need to really study Enumerable. Check out the 'enumerator' module: irb(main):001:0> a = %w{ a b c d e f } => ["a", "b", "c", "d", "e", "f"] irb(main):002:0> require 'enumerator' => true irb(main):003:0> a.each_slice(2) { |x1, x2| p [x1, x2] } ["a", "b"] ["c", "d"] ["e", "f"]