From: Sascha Abel Date: 2007-06-19T18:24:57+09:00 Subject: Re: When file gets closed in a block If you open a file with File#new, you have to close it yourself by calling File#close. --- f = File.new('someFilename', 'w') f.write(text1) f.write(text2) f.close --- You can write as often as you like to f as long as you don't close it. File#open closes the file automatically if passed a block: --- File.open('someFilename', 'w') {|f| f.write(text1) f.write(text2) } --- Without a block File#open ist just an alias for File#new. Sascha -- Posted via http://www.ruby-forum.com/.