unless (eval { ...; 1 }) { ... # handle the error in $@ }