sub stuff { ... } sub err_handler { ... } try \&stuff, catch Error::IO with \&err_handler;