From: Morgan Date: 2005-09-13T08:05:29+09:00 Subject: Re: Adventures in html decoding. Jim Freeze wrote: >This may be off topic, but I always wonder why all the flags to File. >Could what you are doing be written as: > > File.open(ARGV[1], "w") { |outfile| > File.foreach(ARGV[0]) { |line| > outfile.puts CGI::unescapeHTML(line) > } > } > >or am I missing something big here? Well, in this case, I don't believe it's possible to get the effect of File::EXCL (which basically amounts to "don't overwrite an existing file") with a string as the open mode. There are some other combinations of parameters that are also difficult (impossible) to achieve that way. (I don't remember exactly what it was, but I think it had to do with a file that was being opened for reading and writing. All the strings I tried either wouldn't let me access parts of an existing file, or otherwise failed to perfrom as I required.) -Morgan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.10.21/96 - Release Date: 09/10/2005