It happened at about that time that Judah left his brothers, to go down and settle with a certain Adullamite called Hirah.
There Judah saw the daughter of a Canaanite called Shua. He made her his wife and slept with her.
She conceived and gave birth to a son whom she named Er.
She conceived again and gave birth to a son whom she named Onan.
Yet again she gave birth to a son whom she named Shelah. She was at Chezib when she gave birth to him.
Judah took a wife for his first-born Er, and her name was Tamar.
But Er, Judah's first-born, offended Yahweh, and Yahweh killed him.
Then Judah said to Onan, 'Take your brother's wife, and do your duty as her brother-in-law, to maintain your brother's line.'
But Onan, knowing that the line would not count as his, spilt his seed on the ground every time he slept with his brother's wife, to avoid providing offspring for his brother.
What he did was offensive to Yahweh, who killed him too.
Then Judah said to his daughter-in-law Tamar, 'Go home as a widow to your father, until my son Shelah grows up,' for he was thinking, 'He must not die like his brothers.' So Tamar went home to her father.
A long time passed, and then Shua's daughter, the wife of Judah, died. After Judah had been comforted he went up to Timnah for the shearing of his sheep, he and his friend Hirah the Adullamite.
When Tamar was told, 'Look, your father-in-law is going up to Timnah for the shearing of his sheep,'
she changed out of her widow's clothes, wrapped a veil around her to disguise herself, and sat down at the entrance to Enaim, which is on the way to Timnah; for she saw that, although Shelah was grown up, she had not been given to him as his wife.
Judah, seeing her, took her for a prostitute, since her face was veiled.
Going up to her on the road, he said, 'Here, let me sleep with you.' He did not know that she was his daughter-in-law. 'What will you give me for sleeping with you?' she asked.
'I will send you a kid from the flock,' he said. 'Agreed, if you give me a pledge until you send it,' she replied.
'What pledge shall I give you?' he asked. 'Your seal and cord and the staff you are holding,' she replied. He gave them to her and slept with her, and she conceived by him.
Then she got up and left him and, taking off her veil, resumed her widow's weeds.
Judah sent the kid by his friend the Adullamite, to recover the pledge from the woman. But he did not find her.
He enquired from the men of the place, 'Where is the prostitute who was by the roadside at Enaim?' 'There has been no prostitute there,' they answered.
So returning to Judah he said, 'I did not find her. What is more, the men of the place told me there had been no prostitute there.'
'Let her keep the things,' Judah said, 'or we shall become a laughing-stock. At least I sent her this kid, even though you did not find her.'
About three months later, Judah was told, 'Your daughter-in-law has played the harlot; furthermore, she is pregnant, as a result of her misconduct.' 'Bring her out,' Judah ordered, 'and let her be burnt alive!'
But as she was being led off, she sent word to her father-in-law, 'It was the owner of these who made me pregnant. Please verify', she said, 'whose seal and cord and staff these are.'
Judah recognised them and said, 'She was right and I was wrong, since I did not give her to my son Shelah.' He had no further intercourse with her.
When the time for her confinement came, there were twins in her womb!
During the delivery, one of them put out a hand, and the midwife caught it and tied a scarlet thread to it, indicating that this was the first to arrive.
Whereupon, he drew back his hand, and out came his brother. Then she said, 'What a breach you have opened for yourself!' So he was named Perez.
Then his brother came out with the scarlet thread on his hand, so he was named Zerah.