|No such thing as a small change|
Brothers and Sisters, I have seen the error of my ways.
I'm a typical bumbling arts graduate who got into perl because there was a job that needed doing and I've spent my perl life bodging things together with chewing gum and string, hardly using any CPAN modules, being promiscuous with my variables and all that bad stuff. This was the Wrong Kind Of Impatience, really, or what you might call Unreasoning Fear of the J Curve. I always thought "hell, by the time I've learned how to do it right I could already have done it wrong".
Well, the disadvantages of working this way have been piling up day by day. Because of course the older and smellier my mess grows, the harder it gets to modify it. And also, in the short while I've been hanging around here I've been inspired to aspire; and I've learnt quite a lot about what I might aspire to.
So I'm repenting. I've junked the bit of my project that I've been working on for the last three weeks (which should have taken less than a week, and which has in any event almost completely disappeared up its own bottom), and I'm starting fresh. I'm going to use strict with -w. I'm going to use CGI or die;. I'm going to indent four cols, line my closing }s up with the start of the loop and cuddle my elses. I'm going to write pseudocode before I start coding and write a plan before I write the pseudocode. I'm localising my variables.
So my question is: What else should I do?
I had a bit of search through the site and read up perlman:perlstyle and a few other relevant nodes. But I'm greedy. I want all the advice I can get. So, if it's ok with you, I'd like to solicit your views on perl Best Practice. The most general programming rules - the BIG stuff. Advice; injunctions; commandments. Thoughts and links. Do you look back and think "if I'd known then what I know now I'd always have...." ? Then I'd be very grateful to hear the what and the why.
(Indeed, for the practices I already mentioned above, I'd love to read why anyway. I mean, I know for example that I should localise my variables, but I'm not 100% clear what makes this such a good thing to do... and one does the right thing much better if one knows why it's the right thing.)
What I'm hoping for, I guess, is a pre-flight checklist of good perl resolutions. I've given this node a generic name in the hope it may in future answer similar questions for other people in my condition - though of course if there already is such a node that I couldn't find, then that's what I'm looking for and I apologise for taking up your time.