Ben Siders wrote: > I'm not 100% confident that'll work as written. I *think* that if the > open is successful then the die will never execute and that 'if' will > never get checked. If the 'open' is successful on writing to a > non-existant file, I'm not sure if this solution will correct it. > > Dan Muey wrote: > > > Open (...$file ...) || die "Oops I died : $@" if (-e $file);
The Perl syntax is ok (except that it's open(), not Open()). The -e test will occur first. If it succeeds, the open() will be tried and if it fails, the die() will execute. But this kind of construct has a race condition: The file may go into existence between the -e test and the open() call. The correct way to do this is to use sysopen with O_WRITE and omit O_CREAT. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]