eval { something_that_might_die()}; if ($@->isa('FileException')) { handle_file_exception } else { die $@; }