To determine the sex of a corn snake, you can use probing, where a small probe is inserted into the vent opening to check for the presence or absence of hemipenes in males.