in reply to Hope a subroutine will return undef by default
Is there a difficulty or problem with having an explicit return in your subroutine? That is a standard practice for me and I reject any code (in code reviews) that doesn't do so.
Keep in mind that return undef; is not the same as return; and it can lead to some unwanted pain and grief if that is not understood.
Update: You can find a good discussion about the difference between the two here: https://www.securecoding.cert.org/confluence/display/perl/EXP00-PL.+Do+not+return+undef
It helps to remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Hope a subroutine will return undef by default
by choroba (Cardinal) on Feb 11, 2014 at 16:50 UTC | |
by boftx (Deacon) on Feb 11, 2014 at 16:55 UTC | |
Re^2: Hope a subroutine will return undef by default
by Anonymous Monk on Feb 11, 2014 at 17:00 UTC | |
by tye (Sage) on Feb 12, 2014 at 03:42 UTC |
In Section
Seekers of Perl Wisdom