At that time Judah left his brothers and settled near an Adullamite named Hirah.
There Judah saw the daughter of a Canaanite named Shua; he took her as a wife and slept with her.
She conceived and gave birth to a son, and he named him Er.
She conceived again, gave birth to a son, and named him Onan.
She gave birth to another son and named him Shelah. It was at Chezib that she gave birth to him.
Judah got a wife for Er, his firstborn, and her name was Tamar.
Now Er, Judah's firstborn, was evil in the Lord's sight, and the Lord put him to death.
Then Judah said to Onan, "Sleep with your brother's wife. Perform your duty as her brother-in-law and produce offspring for your brother."
But Onan knew that the offspring would not be his; so whenever he slept with his brother's wife, he released his semen on the ground so that he would not produce offspring for his brother.
What he did was evil in the Lord's sight, so He put him to death also.
Then Judah said to his daughter-in-law Tamar, "Remain a widow in your father's house until my son Shelah grows up." For he thought, "He might die too, like his brother." So Tamar went to live in her father's house.
After a long time Judah's wife, the daughter of Shua, died. When Judah had finished mourning, he and his friend Hirah the Adullamite went up to Timnah to the sheepshearers.
Tamar was told, "Your father-in-law is going up to Timnah to shear his sheep."
So she took off her widow's clothes, veiled [her face], covered herself, and sat at the entrance to Enaim, which is on the way to Timnah. For she saw that, though Shelah had grown up, she had not been given to him as a wife.
When Judah saw her, he thought she was a prostitute, for she had covered her face.
He went over to her and said, "Come, let me sleep with you," for he did not know that she was his daughter-in-law. She said, "What will you give me for sleeping with me?"
"I will send you a young goat from my flock," he replied. But she said, "Only if you leave something [with me] until you send it."
"What should I give you?" he asked. She answered, "Your signet ring, your cord, and the staff in your hand." So he gave them to her and slept with her, and she got pregnant by him.
She got up and left, then removed her veil and put her widow's clothes back on.
When Judah sent the young goat by his friend the Adullamite in order to get back the items he had left with the woman, he could not find her.
He asked the men of the place, "Where is the cult prostitute who was beside the road at Enaim?" "There has been no cult prostitute here," they answered.
So the Adullamite returned to Judah, saying, "I couldn't find her, and furthermore, the men of the place said, 'There has been no cult prostitute here.' "
Judah replied, "Let her keep [the items] for herself; otherwise we will become a laughingstock. After all, I did send this young goat, but you couldn't find [her]."
About three months later Judah was told, "Your daughter-in-law has been acting like a prostitute, and now she is pregnant." "Bring her out!" Judah said. "Let her be burned [to death]!"
As she was being brought out, she sent her father-in-law [this message]: "I am pregnant by the man to whom these items belong." And she added, "Examine them. Whose signet ring, cord, and staff are these?"
Judah recognized [them] and said, "She is more in the right than I, since I did not give her to my son Shelah." And he did not know her intimately again.
When the time came for her to give birth, there were twins in her womb.
As she was giving birth, one of them put out his hand, and the midwife took it and tied a scarlet [thread] around it, announcing, "This one came out first."
But then he pulled his hand back, and his brother came out. Then she said, "You have broken out [first]!" So he was named Perez.
Then his brother, who had the scarlet [thread] tied to his hand, came out, and was named Zerah.