in reply to A question about the best way to use subroutines
Here's some fairly common heuristics for you. Factor code out into subroutines when:
- You see sections of code that look nearly identical.
- You realize that some specific task your code performs is just a particular case of a more general task.
- You can imagine a scenario in which your code would be copied-and-pasted somewhere else.
- You can think of your code as performing a "black-box" transaction.
MeowChow s aamecha.s a..a\u$&owag.print
|
---|
In Section
Seekers of Perl Wisdom