Genesis 38:26-30
English Standard Version
27When the time of her labor came, there were twins in her womb.
28And when she was in labor, one put out a hand, and the midwife took and tied a scarlet thread on his hand, saying, "This one came out first."
29But as he drew back his hand, behold, his brother came out. And she said, "What a breach you have made for yourself!" Therefore his name was called Perez.
30Afterward his brother came out with the scarlet thread on his hand, and his name was called Zerah.