[Appendix B] B.7 Exception Handling
Author: Sriram Srinivasan
Date: 1999-07-02T01:43:23Z

#

| Appendix B Syntax Summary |

## B.7 Exception Handling

26. `die` throws an exception, and `eval` traps it. Error string is found in `$@`. The following code has the possibility of two run-time errors:

        eval {
           $c = $a / $b;                                       #1
           die "Denominator cannot be negative" if ($b < 0);   #2
        };
        print "Run-time error: $@";

    `$@` can be "Illegal division by zero" at (1) or "Denominator cannot be negative" at (2).

B.6 Dynamic Behavior |  | B.8 Meta-Information