Genesis 38:23-30

23 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."
24 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."
25 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."
26 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.
27 The time came for Tamar to give birth, and she had twin boys.
28 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."
29 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].
30 After that his brother was born with the red yarn on his hand. He was named Zerah [Sunrise].