Perverse (verse 32) is in Hebrew yarat. It does not quite mean "perverse"; the preferred meaning is interesting: "to precipitate; to be precipitant; to push headlong; to drive recklessly."
God says to Balaam, "Your way is headlong and reckless before Me. It is precipitant." It is as if Balaam were driving 90 mph down a steep hill, heedless of the danger at the bottom. He had no foresight. God says, "That's perverse. Balaam, you are not looking ahead to the consequences! Your way is going to get you into trouble."
He is like a daredevil, like Evel Knievel, who without thought or fear, endangers his and others' lives for his own selfish purposes. He rushes through life for everything that he can get out of it, never thinking about what will happen afterward, in the end. He is a man who cannot look past the end of his nose. He is so consumed with himself that he sees nothing down the road, only what is happening now. God says that is perverse.
A wise man looks ahead and sees where he is going to land. If a man like Balaam gets up a head of steam, he thinks that no one will stop him. Conversely, if we consider the donkey to stand for those who actually see God at work, we can notice a few things:
The donkey responds to God's direction.
The donkey is persecuted for her obedience.
The donkey, in her meekness, does not retaliate. Does she reach back and nip Balaam like he should have been? No.
God says that it is for her sake that He has not carried out His judgment on Balaam. This is interesting because the same thing happens because of us. Jesus calls us the salt of the earth, and part of its meaning is that we are the preservative in this world. If the saints did not exist, there would be no world. This donkey was the only thing standing in God's way of totally consuming Balaam. We are the donkey. Because God has mercy on us, we who see God are the only ones keeping the Balaams of this world from getting totally snuffed out.