> Why not: > > (!(-e $file)) ? die "File doesn't exist: $@\n" : open > (...$file...) or die "File exists but still can't open: $@\n"; >
I don't know. why not? Your idea looks good to me. I was trying to give him a quick one liner but missed the obvious yet again. I think I need a vacation. :) > > 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); > > >Something like that should work > > > > > >Dan > > > > > > > > > > > >>-----Original Message----- > > >>From: Rob Richardson [mailto:[EMAIL PROTECTED]] > > >>Sent: Tuesday, January 14, 2003 12:52 PM > > >>To: [EMAIL PROTECTED] > > >>Subject: RE: Where do die messages go? > > >> > > >> > > >>Greetings! > > >> > > >>If I remember correctly, in either Visual C++ or Visual Basic > > >>(or both) there is a way to call open() (or its equivalent) > > >>for appending and to have it fail if the file doesn't > > >>previously exist. Is there a way to do that in Perl? > > >> > > >>Merely curious -- I'm not likely to need this in the near future. > > >> > > >>RobR > > >> > > >> > > >> > > >>__________________________________________________ > > >>Do you Yahoo!? > > >>Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > > >> > > >> > > >http://mailplus.yahoo.com > > > > > > > > > > > > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]