B
bernd
Hello folks,
I wondering whether it is possible to execute more statements than the
"traditional" die after the invocation of open in a perl script:
Instead of:
open (FH, ">testfile") or die "Cannot open testfile" ;
I want to do a little bit more. My idea is deployment of a "do"-block
open (FH, ">testfile") or do { # some other stuff, e.g. sending a mail
message; die "Cannot open testfile" }
my @include ;
This does not seem to work. In my case the statement declaring an
array immediately after the do block is refused by the compiler with
the message:
"Global symbol @include requires a package name..."
Apart from the $SIG(__DIE__)-stuff, which, from my point of view is
not that obvious, do I have any other possibility?
Cheers
Bernd
I wondering whether it is possible to execute more statements than the
"traditional" die after the invocation of open in a perl script:
Instead of:
open (FH, ">testfile") or die "Cannot open testfile" ;
I want to do a little bit more. My idea is deployment of a "do"-block
open (FH, ">testfile") or do { # some other stuff, e.g. sending a mail
message; die "Cannot open testfile" }
my @include ;
This does not seem to work. In my case the statement declaring an
array immediately after the do block is refused by the compiler with
the message:
"Global symbol @include requires a package name..."
Apart from the $SIG(__DIE__)-stuff, which, from my point of view is
not that obvious, do I have any other possibility?
Cheers
Bernd