Hi,

From: <dblack / candle.superlink.net>

> 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