in reply to Re^2: [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?

I didn't say a few people don't use the practice. In fact, I don't think I've come across any CPAN code that uses the practice. Claims of shoddiness seem to be *greatly* exaggerated.
  • Comment on Re^3: [SOLVED] Return statement in subroutine(s) is necessary when not returning anything?

Replies are listed 'Best First'.
Re^4: [SOLVED] Return statement in subroutine(s) is necessary when not returning anything?
by Preceptor (Deacon) on Nov 06, 2015 at 12:05 UTC

    Indeed.

    But my point was just because a lot of people do something, really doesn't have any bearing on it being a good - or bad - practice. Argumentum ad populum

    Especially in perl, which lets you get away with all sorts of horrific nastiness for extended periods of time.

      I didn't say "lot of module use the practice"; I said "lots of that modules that work perfectly fine use the practice". When the argument against the practice is that cause things to malfunction, this isn't argumentum ad populum.

      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).