Genesis.
Chapter 38.
Around this time, Judah left his brothers and set up his tents at Adullam, near to a local man named Hirah. 
There Judah happened to see the daughter of a Canaanite man named Shua and married her. He slept with her, 
and she became pregnant and had a son he named Er. 
She became pregnant again and had a son she named Onan. 
Then she had another son she named Shelah who was born in Kezib. 
Much later, Judah arranged for Er, his firstborn son, to marry a woman named Tamar. 
But Er did what was evil in the Lord's sight, so the Lord put him to death. 
Judah told Onan, “Go and sleep with your brother's wife to fulfill the requirements of a brother-in-law to have children on behalf of your brother.” 
Onan realized that any children he had wouldn't be his own, so whenever he slept with his brother's wife he made sure she wouldn't become pregnant by withdrawing and spilling his semen on the ground. In this way he prevented any children being born on behalf of his brother. 
But what he did was evil in the Lord's sight, so he also put Onan to death. 
Then Judah told his daughter-in-law Tamar, “Go to your father's house and live there as a widow until my son Shelah grows up.” For he thought, “Maybe he'll die too, just like his brothers.” So Tamar went and stayed in her father's house. 
A long time later Judah's wife, the daughter of Shua, died. After Judah had finished the time of mourning, he went to visit his sheepshearers at Timnah with his friend Hirah from Adullam. 
Tamar was told, “Your father-in-law is going to Timnah to shear his sheep.” 
So she took off her widow's clothes and covered herself with a veil, disguising herself. She sat down beside the entrance to Enaim, which is on the way to Timnah. She had realized that even though Shelah had now grown up, nothing had been done about her marrying him. 
Judah saw her and thought she must be a prostitute because she had veiled her face. 
He went over to her at the side of the road and said, “I want to sleep with you.” He didn't know she was his daughter-in-law. “What will you give me if I let you sleep with me?” she asked. 
“I'll send you a young goat from my flock,” he replied. “What guarantee will you give me to make sure you'll send it?” she asked. 
“What guarantee do I have to give you?” he asked. “Your signet seal and its cord, and your walking stick that you're holding,” she replied. He handed them over to her. He slept with her and she became pregnant. 
She left, went home, took off her veil, and put on her widow's clothes. 
Judah sent his friend Hirah from Adullam with a young goat to get back his belongings he'd left as a guarantee from the woman, but he couldn't find her. 
Hirah asked the men there, “Where's the cult prostitute that sits by the entrance road to Enaim?” “There's no cult prostitute here,” they answered. 
Hirah went back to Judah and told him, “I couldn't find her, and the men there said, ‘There's no cult prostitute here.’” 
“Let her keep what I gave her,” Judah replied. “We'll look ridiculous to people if we go on searching. In any case I did try to send her the young goat as promised but you couldn't find her.” 
Then about three months later Judah was told, “Tamar your daughter-in-law has had sex like a prostitute and now as a result she's pregnant!” “Bring her out and burn her to death!” Judah ordered. 
As she was brought out, she sent a message to her father-in-law, saying, “I'm pregnant by the man who owns these things.” Then she added, “Please look carefully at this signet seal and its cord and walking stick. Who do they belong to?” 
Judah recognized them right away and said, “She has honored the law more than I have, because I didn't give her in marriage to my son Shelah.” He didn't sleep with Tamar again. 
When the time came for Tamar to give birth, she was found to be carrying twins. 
One baby put out his hand, and the midwife tied a scarlet thread around on his wrist and said, “This one came out first.” 
But then he pulled back his hand and his brother was born, she said, “How did you burst out?” So he was named Perez. 
Then his brother with the scarlet thread on his wrist was born. He was named Zerah. 
