But Onan knew that the heir would not be his; and it came to pass, when he went in to his brother's wife, that he emitted on the ground, lest he should give an heir to his brother.
Then Judah said to Tamar his daughter-in-law, "Remain a widow in your father's house till my son Shelah is grown." For he said, "Lest he also die like his brothers." And Tamar went and dwelt in her father's house.
Now in the process of time the daughter of Shua, Judah's wife, died; and Judah was comforted, and went up to his sheepshearers at Timnah, he and his friend Hirah the Adullamite.
So she took off her widow's garments, covered [herself] with a veil and wrapped herself, and sat in an open place which [was] on the way to Timnah; for she saw that Shelah was grown, and she was not given to him as a wife.
Then he turned to her by the way, and said, "Please let me come in to you"; for he did not know that she [was] his daughter-in-law. So she said, "What will you give me, that you may come in to me?"
Then he said, "What pledge shall I give you?" So she said, "Your signet and cord, and your staff that [is] in your hand." Then he gave [them] to her, and went in to her, and she conceived by him.
Then he asked the men of that place, saying, "Where is the harlot who [was] openly by the roadside?" And they said, "There was no harlot in this [place."]
And it came to pass, about three months after, that Judah was told, saying, "Tamar your daughter-in-law has played the harlot; furthermore she [is] with child by harlotry." So Judah said, "Bring her out and let her be burned!"
When she [was] brought out, she sent to her father-in-law, saying, "By the man to whom these belong, I [am] with child." And she said, "Please determine whose these [are -- the] signet and cord, and staff."
And so it was, when she was giving birth, that [the one] put out [his] hand; and the midwife took a scarlet [thread] and bound it on his hand, saying, "This one came out first."
Then it happened, as he drew back his hand, that his brother came out unexpectedly; and she said, "How did you break through? [This] breach [be] upon you!" Therefore his name was called Perez.