I last left off describing how Joseph gets screwed by his brothers. I should have mentioned that one of them, Judah, was actually against it and spoke up on his behalf. No matter. Genesis 38 turns to Judah and some of the weird stuff that goes on between him and the ladies.
Judah goes off the beaten path and marries this woman named Shua, who bears him three sons. The firstborn is called Er, which sounds like something hipster parents would come up with. The other two sons are called Onan and Shelah (confusing for everyone). Er was "wicked in the sight of the Lord" (Gen 38:7) so the Lord slew him. Lack of specificity is an issue in the Bible. Judah encourages Onan to do his brotherly duty and have sex with Er's wife, Tamar. For some reason, Onan is against impregnating his dead brother's wife and decides to pull out. And wouldn't you know it - the Lord doesn't like all this perfectly useful semen being wasted and slays Onan, too. This is the first time I've come across the word "semen" in the Bible.
Tamar is an odd duck because she gets it into her head that it'd be a fun prank to disguise herself and have sex with Judah. When he encounters her, Judah thinks that she's a harlot because her face is covered and he trades sex with her for his signet (a seal), cord and staff. I don't know what use this stuff is to her. Anyway, she gets pregnant and three months later Judah is told, "Tamar, your daughter-in-law has played the harlot; and moreover she is with child by harlotry" (Gen 38:24). When he realizes that she's pregnant by him his initial reaction is to burn her but then he feels bad that he didn't give her to his youngest son Shelah (which I guess would have been the proper thing to do). He probably didn't think of Shelah because he has a girl's name. Tamar has twins: one is named Zerah and the other (ethnic) one, Perez.