"For the eyes of the Lord run to and fro throughout the whole earth, to shew himself strong in the behalf of them whose heart is perfect toward him. Herein thou hast done foolishly: therefore from henceforth thou shalt have wars."
2 Chronicles 16:9
What does it mean to have a perfect heart? It means to have a heartfelt desire to do right and to please God. A person who has a perfect heart truly loves God, though he himself may not be perfect. He may still have things in the flesh to deal with. His mouth may still get him into trouble. He may make mistakes or lose his temper. But when he does, he is quick to repent and make it right with God again. If he has offended someone else, he will humble himself and apologize.
When God looks into our lives, He doesn't look for somebody with a perfect performance but a terrible heart attitude. He looks for someone who may not have a perfect performance but who has a right attitude toward Him. If we have a perfect heart toward God, He counts us as perfect and works with us while we are trying to manifest that perfection.