From: Bulat Ziganshin Date: 2002-12-19T00:18:10+09:00 Subject: Re: hash vs. array (dictionary lookup) Hello Shannon, Wednesday, December 18, 2002, 5:19:50 PM, you wrote: SF> f=File.new("dict.txt") SF> text=f.sysread(File.size("dict.txt")) SF> lexicon=text.split(/\n/) if lexicon.size % 2 == 0 hash = Hash[ *lexicon ] hash.update Hash[ *(lexicon[1..-1] + [0]) ] else hash = Hash[ *(lexicon + [0]) ] hash.update Hash[ *lexicon[1..-1] ] end as alternative, see Marshal class: 1) run this program one time: ..... # your code for reading lexicon from text file File.open("posterity", "w+") do |f| Marshal.dump(lexicon, f) end 2) use this code to restore lexicon: lexicon = '' File.open("posterity") do |f| lexicon = Marshal.load(f) end ..... # using lexicon -- Best regards, Bulat mailto:bulatz@integ.ru