Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I'd add:
Introduce and initialize each variable in the smallest scope possible.In other words, I find code that starts out with dozens of "my" declarations to generally spell trouble for maintenance or debugging. Instead, variables should be introduced right where they are needed, initialized with the correct value for that step of the coding. If necessary, refactor the code into subroutines so that the lifetime and visibility of the variables can be reduced even further. Take a look at my columns (especially the later ones) for examples of "just-in-time declaration and initialization". Programming with globals is so 80's. {grin} -- Randal L. Schwartz, Perl hacker
In reply to Re: coding rules
by merlyn
|
|