in reply to Re^4: [SOLVED] Return statement in subroutine(s) is necessary when not returning anything?
in thread [SOLVED] Return statement in subroutine(s) is necessary when not returning anything?

The opposite is also true. Just because something is rarely used doesn't make it a good practice. Nearly no one really means just that. You can argue that nearly every single author on CPAN writes shoddy code 100% of the time but I don't think the argument has much traction. :P

Returning to the OP and the theme at hand. Printing from subroutines is a poor practice. They should return data for the controller (program flow) to use. Printing from a sub breaks its extensibility, limits its usefulness, and encourages code duplication (by avoiding view/template practices and making things impossible to reuse as is).

  • Comment on Re^5: [SOLVED] Return statement in subroutine(s) is necessary when not returning anything?