In Vayeishev, when Tamar's twins were born, the one baby stuck his hand out during labor, and the midwife tied a string around it to show that that was the firstborn (see 38:28). (The baby actually stuck its hand back inside Tamar and the other baby came out first.
It seems that this pasuk is hinting to a certain halacha. See Kiddushin 74a: "Rav Nachman says: Three people are beleived to tell us which child is the firstborn: the widwife, mother and father. The midwife is believed [only] immediately [after birth], the mother for seven days [as Rashi says until the Bris] and the father forever."
Here the midwife immediately took steps to identify the firstborn - because, as midwife, that is the only time she has neemanus to do so.