I feel that consistency is the most important thing for writing maintainable code in any language. Being consistent with your indentation is probably the first thing to get right . The perlstyle man page has lots of recommendations for 'standard' Perl style.
Comments used in moderation can also be very helpful. I always like to include a comment before each subroutine which describes what it takes, what it does and what it returns. Of course these comments are worse than useless if you don't change them when you change your code. On the other hand, this sort of comment probably isn't very useful:
# print out the results print $results;
Using sensible identifier names (eg: variables typically nouns and subroutines typically including a verb) should help make the code fairly readable without having lots of comments.
I also recommend breaking up long sections of code into subroutines with descriptive names. That way someone can 'zero-in' quickly on the section they're looking for.
And no, you wouldn't have to look very far at all to find examples of my code where I have failed to meet my own recommendations :-(
Update: I also meant to point out that searching for maintainable code would probably be another good place to start.
In reply to Re: What is maintainable perl code?
by grantm
in thread What is maintainable perl code?
by disciple
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |