And, on the flip side of not having a perfect hero, you also don't want to have a character who is a complete villain.
A villain is usually the antagonist of the story, the bad guy, the person who doesn't want to let the hero achieve the hero's goal. But a character who is villainous throughout borders on melodrama. When writing about villains, we have to remember that they often have the same desires and motivations as the good guys
As Masello notes, and many other writers have said, true villains don't think of themselves as evil. Instead, they think of themselves as doing good. Very few people (other than sociopaths) wake up in the morning and declare that they will do evil today. Instead, they try to do what they think is right, even if they know that general morality might disagree. Some of these people even consider themselves above regular morality, assuming that the ends justify the means.
I could look to the real world for examples, but I'm reluctant to do such a thing. Instead, I'll present the example of Raskolnikov from the Dostoyevsky novel Crime and Punishment, who early on in the novel has convinced himself that he has the right to commit murder for the greater good. And looking to the world of comic books, the current incarnation of Lex Luthor may be power-hungry, but it's his distrust of alien influences on humanity that most motivates him to fight against Superman.
In one of the stories I worked on recently, my hero, a young woman, faced off against the villain, a middle-aged man, at the very end. Although it's slightly cliched, he explained to her the motivations behind his actions, and for a moment there my hero's resolve wavered. The villain did in fact have excellent reasons for his actions, actions that he truly believed would bring about a better world, even if it meant killing a few people -- such as my hero -- along the way. Fortunately, she stuck to her resolve and defeated the villain rather than joining him in his evil ways.
One other final thought. When I took his course on comic book writing, Dennis O'Neil advised us to give the villain an advantage of some sort over the hero in every story, so that it would always look more hopeless for the hero until the end. I think that also falls under Masello's rule #36; after all, the more advantages you give your villain, the more perfect your villain becomes.