About that time Judah left his brothers and went to stay with a man from Adullam whose name was Hirah.
There Judah met the daughter of a Canaanite man whose name was Shua. He married her and slept with her.
She became pregnant and gave birth to a son named Er.
She became pregnant again and gave birth to another son, whom she named Onan.
Then she became pregnant again and gave birth to another son, whom she named Shelah. He was born at Kezib.
Judah chose a wife for his firstborn son Er. Her name was Tamar.
Er angered the LORD. So the LORD took away his life.
Then Judah said to Onan, "Go sleep with your brother's widow. Do your duty for her as a brother-in-law, and produce a descendant for your brother."
But Onan knew that the descendant wouldn't belong to him, so whenever he slept with his brother's widow, he wasted his semen on the ground to avoid giving his brother a descendant.
What Onan did angered the LORD so much that the LORD took away Onan's life too.
Then Judah said to his daughter-in-law Tamar, "Return to your father's home. Live as a widow until my son Shelah grows up." He thought that this son, too, might die like his brothers. So Tamar went to live in her father's home.
After a long time Judah's wife, the daughter of Shua, died. When Judah had finished mourning, he and his friend Hirah from Adullam went to Timnah where the men were shearing Judah's sheep.
As soon as Tamar was told that her father-in-law was on his way to Timnah to shear his sheep,
she took off her widow's clothes, covered her face with a veil, and disguised herself. Then she sat down at the entrance to Enaim, which is on the road to Timnah. (She did this because she realized that Shelah was grown up now, and she hadn't been given to him in marriage.)
When Judah saw her, he thought she was a prostitute because she had covered her face.
Since he didn't know she was his daughter-in-law, he approached her by the roadside and said, "Come on, let's sleep together!" She asked, "What will you pay to sleep with me?"
"I'll send you a young goat from the flock," he answered. She said, "First give me something as a deposit until you send it."
"What should I give you as a deposit?" he asked. "Your signet ring, its cord, and the shepherd's staff that's in your hand," she answered. So he gave them to her. Then he slept with her, and she became pregnant.
After she got up and left, she took off her veil and put her widow's clothes back on.
Judah sent his friend Hirah to deliver the young goat so that he could get back his deposit from the woman, but his friend couldn't find her.
He asked the men of that area, "Where's that prostitute who was beside the road at Enaim?" "There's no prostitute here," they answered.
So he went back to Judah and said, "I couldn't find her. Even the men of that area said, 'There's no prostitute here.'"
Then Judah said, "Let her keep what I gave her, or we'll become a laughingstock. After all, I did send her this young goat, but you couldn't find her."
About three months later Judah was told, "Your daughter-in-law Tamar has been acting like a prostitute. What's more, because of it she's pregnant." Judah ordered, "Bring her out to be burned."
As she was brought out, she sent a message to her father-in-law, "I'm pregnant by the man who owns these things. See if you recognize whose signet ring, cord, and shepherd's staff these are."
Judah recognized them and said, "She's not guilty. I am! She did this because I haven't given her my son Shelah." Judah never made love to her again.
The time came for Tamar to give birth, and she had twin boys.
When she was giving birth, one of them put out his hand. The midwife took a piece of red yarn, tied it on his wrist, and said, "This one came out first."
As he pulled back his hand, his brother was born. So she said, "Is this how you burst into the world!" He was named Perez [Bursting Into].
After that his brother was born with the red yarn on his hand. He was named Zerah [Sunrise].