I'm prepared to agree that the Torah is perfect, but we human beings are not. Any attempt we humans make to interpret or apply the Torah must be filtered through our own limited perceptions. Approach that exercise of interpretation/application with, e.g., a pre-existing condition of bigotry, and you'll likely conclude that the Torah enshrines that bigotry when in fact it does nothing of the sort. That's in your head, not in the Torah.
All of us ignore what we wish to ignore. In the same way, we all choose to emphasize what we wish to emphasize. If you choose to emphasize the anti-gay parts of the Torah, or the anti-black midrashim, or the misogynistic asides that are all over the Talmud that says something about YOU, not about the Torah.