missingthepoint has asked for the wisdom of the Perl Monks concerning the following question:

Greetings, monks.

This is a 'meta-programming' question, I guess... Recently I've been meditating upon the cause of the errors I make while programming. It seems that most of my errors are what you might call 'silly mistakes'.

For instance, recently I decided to expand my mind and learn another programming paradigm (in addition to 'imperative', which is all I've had thus far). So I set out through perltoot, and learned much. Along the way I learned about destructors and how they must be named 'DESTROY'. So I proceeded to add a thus-named sub to my source file... which promptly failed to run. After 10 seconds reflection and a forehead smack, I had put the sub in my class's module, instead of the file which use()d that module. Then it ran. Doh!

My other silly mistakes are similar - they generally take 10 seconds to fix, but can take longer to spot, especially if sleep-deprived. What annoys me is that I waste time this way. If I was paying attention in the first place, I reason, I would be a more productive (and less stressed) coder.

Can any other monks relate to this behavior? What are your strategies for avoiding those 'doh' moments? Obviously experience helps, but are there things I could do now to reduce the number of silly mistakes I make?

I eagerly await your monastic wisdom.

P.S. Please be nice, it's my first post. :o)

-- email: perl -e 'print scalar reverse map { chr( ord($_)-1 ) } split //, "ufo/hojsfufqAofc";'