http://www.perlmonks.org?node_id=900989


in reply to Collect prints to a string

The idea of a function is normally to return something. In other languages there is a way to notify the user whether or not a function was supposed to be used to return anything (like declaring it void, etc.). There is not anything like this in Perl (that I know of) so my best practice is to almost always write functions to return something, even if that something is only undef. Whatever solution you come up with, I would add it to your coding standards. I added this section and all this help about refactoring because I think the code you have posted probably needs to be rewritten. There are good, safe ways to do that using Perl utilities.

Update: Oops, I forgot to mention that your tests will break if you add new stuff like  qq| to be.|. The right approach should be to just call the old functions in the new without appending anything and rerun your tests. They should all pass. Then rewrite your tests to match your next version's changes. You should be using a version control system, so you should be able to easily differentiate versions and tag releases along with associated tests.

Celebrate Intellectual Diversity