eval{ ...code...}; if ($@) { handle error }