The "or " can call a subroutine.
open (TEST, ">/tmp/test") or myDie();
sub myDie {
syslog("LOG_ALERT","Could not open test file");
die "Could not open test file\n";
}
On Tue, 2005-01-25 at 08:17 -0600, Rod Jenkins wrote:
> 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.
>
>
>
>
> Rod Jenkins
>
>
> Rod Jenkins
> ISP Systems Engineer
> Iowa Telecomunications Systems
> Cell: (641) 521-4423
>
> PGP Key: http://www.iowatelecom.net/~rodj/key.txt
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>