eval { yourDBIsubroutine() }; if ($@) { print "error:\n$@\n" }