Hi, > After a failed open, I want to run two statements for an "or die". > > Code Quesiton: > > open (TEST, ">/tmp/test") > or { > die "Could not open test file\n"; > syslog("LOG_ALERT","Could not open test file"); > }; > > This does not work, but what is the "right" way to do this? > I know I could write a MyDie sub and pass a string to it.
For clarity's sake you could write: if( open(TEST, ">/tmp/test") ){ # code goes here } else { # do important stuff, then die. Won't work the other way # 'round, just like in Real Life. syslog("LOG_ALERT","Could not open test file"); die "Could not open test file\n"; } HTH, Thomas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>