There is never any justification for perjury. In Mayella's case, her claim that Tom Robinson has raped her and her false testimony against this man causes him his very life; she has, then, directly caused his death. Whatever consequences she would have suffered from her father by telling him the truth that she was lonely and she invited Tom into the house on the false pretext of breaking down a chiffarobe are small in comparison to the consequences that have resulted from the trial. As it was, Bob Ewell abused her anyway when he arrived home and saw Tom Robinson in his house. And, since there is already an incestuous relationship with her father, whatever abuse is there that he could dole out to Mayella beyond what she already has not suffered? But, Mayella lacks the fortitude to tell the truth, and she costs a man his life.
After the trial, Dill is so struck by the raw cruelty and injustice of it that he cries. Consoling and instructive, Mr. Dolphus Raymond tells Dill,
"Cry about the simple hell people give other people--without even thinking. Cry about the hell white people give colored folks, without even stopping to think that they're people, too."
Scout joins in and says,
"Atticus says cheatin' a colored man is ten times worse than cheatin' a white man....Says it's the worst thing you can do."
Mayella Ewell has "cheated a colored man"; it is, indeed, the worst thing that she has done.