Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Please advise how I can call a subroutine in a die statement. I have a mail subroutine that I want to call if a file doesnt open and I want to get the error message to print out in my STDERR.
This is not working but this is what Iam trying to do:
This is not working but this is what Iam trying to do:
sub mysub { mail stuff here.. } open(TMPFILE,"<datafile.txt") || die "Cant open: $!" mysub();
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: die and subroutine combo
by broquaint (Abbot) on Oct 08, 2003 at 11:08 UTC | |
Re: die and subroutine combo
by bart (Canon) on Oct 08, 2003 at 11:10 UTC | |
Re: die and subroutine combo
by crouchingpenguin (Priest) on Oct 08, 2003 at 13:22 UTC | |
Re: die and subroutine combo
by flounder99 (Friar) on Oct 08, 2003 at 12:32 UTC |
Back to
Seekers of Perl Wisdom