sub that_cgi_script { ... eval { do_something() }; ... } sub do_something { # 1) may return if everything ok # 2) may die on error, but such error non-important to # calling code in above case and will be catched by # eval and ignored # 3) may redirect: print Location header and call exit() }