P is for Practical | |
PerlMonks |
Re: efficient use of subroutinesby BillKSmith (Monsignor) |
on Feb 05, 2015 at 23:54 UTC ( [id://1115717]=note: print w/replies, xml ) | Need Help?? |
Several people have said that a subroutine should "do one thing." In that spirit, there is a simple test for whether or not a block of code should be a subroutine. If the code can be completely described in one sentence with no 'and', 'or' or 'but', it probably should be a subroutine. Note: This is not an original idea. It is paraphrased from Yordon and Constantine's 1979 book "Structured Design" UPDATE: Corrected Reference.
Bill
In Section
Seekers of Perl Wisdom
|
|