#!/usr/bin/perl -w
######################################################################
# exception.pl
######################################################################
# Perl Power! - Michael Schilli 1998
######################################################################

eval {          # critical block

    for($i=1; $i<10; $i++) {
        if($i == 9) {
            die "i is 9!";     # die() does _not_ abort the
                               # script, but only processing
                               # of the eval block
        }
    }
};              # end of the critical block

if($@) {        # has an error occurred?
    print "An error has occurred: $@";
}

