At that time, Judah moved away from his brothers and settled near an Adullamite named Hirah.
There Judah saw the daughter of a Canaanite whose name was Shua, and he married her. After he slept with her,
she became pregnant and gave birth to a son, whom she named Er.
She became pregnant again, gave birth to a son, and named him Onan.
Then she gave birth to one more son and named him Shelah. She was in Chezib when she gave birth to him.
Judah married his oldest son Er to a woman named Tamar.
But the LORD considered Judah's oldest son Er immoral, and the LORD put him to death.
Judah said to Onan, "Go to your brother's wife, do your duty as her brother-in-law, and provide children for your brother."
Onan knew the children wouldn't be his so when he slept with his brother's wife, he wasted his semen on the ground, so he wouldn't give his brother children.
The LORD considered what he did as wrong and put him to death too.
Judah said to Tamar his daughter-in-law, "Stay as a widow in your father's household until my son Shelah grows up." He thought Shelah would die like his brothers had. So Tamar went and lived in her father's household.
After a long time, Judah's wife the daughter of Shua died. Then, after a period of mourning, he and his neighbor Hirah the Adullamite went up to Timnah, to those who were shearing his sheep.
Tamar was told, "Your father-in-law is now on his way up to Timnah to shear his sheep."
So Tamar took off the clothing she wore as a widow, covered herself with a veil, put on makeup, and sat down at the entrance to Enaim on the road to Timnah, since she realized that although Shelah had already grown up, she hadn't been given to him as a wife.
Judah saw her and thought she was a prostitute because she had covered her face.
He turned to her beside the road and said, "Let me sleep with you," because he didn't know she was his daughter-in-law. She said, "What will you give me for sleeping with you?"
He said, "I will give you a kid goat from my flock." She said, "Only if you give me some deposit, as security to guarantee that you will send it."
He said, "What kind of deposit should I give you?" And she said, "Your seal, its cord, and the staff in your hand." He gave these to her, slept with her, and she became pregnant by him.
Then she got up, left, and took off her veil, dressing once again in the clothing she wore as a widow.
Judah sent the kid goat with his neighbor the Adullamite so he could take back the deposits from the woman, but he couldn't find her.
He asked the locals of that place, "Where's the consecrated worker who was at Enaim on the road?" But they said, "There's no consecrated worker here."
So he went back to Judah and said, "I couldn't find her. The locals even said, ‘There's no holy woman here.'"
Judah said, "Let her keep everything so we aren't laughed at. I did send this kid goat, but you couldn't find her."
About three months later, Judah was told, "Your daughter-in-law Tamar has become a prostitute and is now pregnant because of it." And Judah said, "Bring her out so that she may be burned."
When she was brought out, she sent this message to her father-in-law, "I'm pregnant by the man who owns these things. See if you recognize whose seal, cord, and staff these are."
Judah recognized them and said, "She's more righteous than I am, because I didn't allow her to marry my son Shelah." Judah never knew her intimately again.
When she gave birth, she discovered she had twins in her womb.
At birth, one boy put out his hand, and the midwife took it and tied a red thread on his hand, saying, "This one came out first."
As soon as he pulled his hand back, his brother came out, and she said, "You've burst out on your own." So he was named Perez.
Afterward, his brother with the red thread on his hand came out, and he was named Zerah.