![]() |
|
Perl: the Markov chain saw | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
Make it a habit to review old code, It'll do your code and your coding expertise good.
Indeed! This doesn't just apply to copy and paste either, as I often find things that can be done better or simply coded more clearly when I pull out some little program I wrote 6 months ago. I take the fact that I'm using it a second time as a sign that a little more investment of effort could well pay off in the future. Recently I have found myself replacing silly little loops with map or grep (as appropriate) and finding the clarity of the code improves significantly. On your specific example, you could go a step farther and eliminate the multiple sprintf calls. On my box (Win95, ActiveState 628) this appears to be 20% faster than the array improvement alone:
-- In reply to Re: old code revisited
by Albannach
|
|