No such thing as a small change | |
PerlMonks |
Re: Refactor huge subroutineby grep (Monsignor) |
on Aug 13, 2008 at 04:03 UTC ( [id://704031]=note: print w/replies, xml ) | Need Help?? |
A couple of comments:
Those labels look like a good place to start. sub them out and pass the array. Those large, gnarly if/elsif clauses would be my next step. Create a descriptively named sub like has_many_valid_lodgements, move the logic there and return true or false. This also has the advantage of self-documenting your code. No one will be able to quickly discern what means. Look for copy-and-paste code like the Date_Cmp's. Get rid of them. Make 1 sub and name it well. Other Notes:
grep One dead unjugged rabbit fish later...
In Section
Seekers of Perl Wisdom
|
|