We've lived in the age of perfectionism, longer than we have lived in the age of development driven by our own mistakes, and our approach of learning from those mistakes. It is of high importance that we acknowledge the fact that it's impossible to be flawless every time.
You should know that it's more about the ability to make the code to work, than it is about making the code look exceptionally good, so that you can boast to your co-workers and close friends. Get comfortable with the fact that your code is going to fail and disappoint you, because that's the only way forward.
I, personally, think that the one time we realize that perfectionism is rubbish, is when we're forced to work on an issue, real-time. An issue so important, it needs to be fixed as quickly as humanly possible. That is the one time that we realize, getting something to work on production environment is far more important than making something look pretty for the sake of it.
Yes, code golf is encouraged, it allows you to examine your abilities through a new set of eyes, but should you golf our way toward a solution for an important issue, upon which the business you're working for depends on? I thought so.
How can we fail less, avoid perfectionism and feel much safer when working with our code? I've got some ideas, but I'd love to hear yours.
Testing Your Code
I strongly believe that unit testing is not just something that happens, or can happens, it's a natural part of the programmers life, and should be looked at as something that adds flavor to the whole experience. 
Make it a habit, a part of your development environment, to write code tests whenever possible. I've no doubt that you've already done it a couple of times, but it's one thing to write passable tests, and another to have the application work as intended.
Production Environment != Playground
Your worst enemy is your production environment, you should always have a relationship with it, one where you shake hands before interacting with each other, just to make sure that you don't blindly do something stupid and unrecoverable.
In 1997, about a year after launch, Hotmail was growing exponentially, adding thousands of new users every day. We were on fire. And then one night, it all seemed to unravel. We had a program called the 'janitor' that ran as an overnight batch process and it erased all of the email that users put in the 'trash' folder. Except this night, a bug spawned an army of other janitors that cleaned out everyone's inboxes, too. That's right, deep-sixed their email. Here is what went through all our spinning heads: 'We're fucked, it's over.'" 
I really enjoyed that story, because it doesn't just capture some of the essence of how things were back then, it goes to show that mistakes are part of the whole development process, and whether we like it or not, failure is a good thing.
Failure is Temporary, Recover
Never give up on something that has failed, and needs to be fixed. It's the illusion of thinking that the bug that has just appeared is not possible to fix, and the whole platform needs to be rewritten from scratch, in order to get it going again. You'd be surprised to learn how many developers think that way.
Perfectionism is easy to be blinded by, because we've gotten used to doing things our way, and we prefer to make things the way we want them to be. Only when we begin to steer away from being perfect, we realize how much more open we are to new possibilities.
comic by xkcd