From: Wilson Bilkovich Date: 2005-12-31T08:07:22+09:00 Subject: Re: Another Newb asks questions. On 12/30/05, Joseph Divelbiss wrote: > Wilson Bilkovich wrote: > > > This solution uses the 'enumerator' module, included in the standard > > library. > > > > Very good solution. Ill look into it ans see how it works. Thanks. > Here's another, much uglier solution, that doesn't rely on Enumerator. There's probably a better way, but hey, you get what you pay for. :) Dir.chdir(script_data_dir) type_hash = Hash.new File.open('type.dat','r') do |file| odd = [] ; even = [] file.each do |line| if file.lineno % 2 == 1 then odd << line.chomp else even << line.chomp end end odd.each_with_index { |line, i| type_hash[line] = even[i]} end