From: Bill Kelly Date: 2002-11-25T01:28:02+09:00 Subject: Re: Ruby idom needed Hi, From: > On Sun, 24 Nov 2002, Robert Cowham wrote: > > h = {} > > f = File.open("fred.ini", "r") > > f.each_line{|l| s = l.chomp.split("="); h[s[0]] = s[1]} > > f.close > 1. > > h = Hash[*File.new("fred.ini").read.split(/=|\n/)] I like the above, but wondered it it leaves the file open? Here's a slightly modified version: h = Hash[*File.open("fred.ini"){|f| f.read.split(/=|\n/)}] Regards, Bill