eval { # Do stuff }; if($@) { # Handle any errors }