In reading so far, I see lots of great comments on this thread, and look forward to more of them. A most excellent post, and I think you hit quite a few of good points in it, with more good points being touched on in the follow-ups to the thread. I look forward to reading the postings of others, for they may expand my own approach to this question.
My own opinion is that "maintainable" takes on multiple meanings. Two of the more important ones that come to mind are:
- That it doesn't take an unreasonable amount of experience for someone to be able to look at the code, figure out what it is doing, and perform maintenance on the code. Using modules, good/standard coding practices (strict and warnings, not depending on side-effects, etc.), and documentation, all help in this respect.
- That the code is not so fragile that the (inevitable) modifications that will be requested or needed do not break it so badly that it must be completely rewritten from scratch again. When I think of this one, I'm not considering the single-use script you do for a one-time data massage and import, but instead the application that is used every day that causes screams and such when/if it were to break. Using modules (especially using CPAN modules when you don't have to roll your own), OO (when appropriate), and good design, all help when this is considered.