Is there a way I can avoid to check after each call the content of $error_msg, in order to return to the caller, and have it "implicitly" present in the subroutine ? - yes with exeptions. For example you can use Error or Exception modules for this. Recently there was some discussion here about error handling in general: Error reporting in modules, How to say 'oops' in OOPs?.