use Try::Tiny; sub foo { try { die; } catch { print 'error'; return; }; print 'no_err'; } foo;