Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

by Your Mother (Archbishop)
on Nov 06, 2015 at 13:28 UTC ( [id://1147096]=note: print w/replies, xml ) Need Help??


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?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1147096]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2026-04-17 00:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.