package Library.pm use Library.pm printInformationWrapper() { my @captureSTDOUT; my @captureSTDERR; # Set state so that: # @captureSTDOUT is populated with all STDOUT. # @captureSTDERR is populated with all STDERR. printInformation(); # Set state back to previous if (@captureSTDOUT > 0) { # Deal with it. } return @captureSTDOUT; }