Pinworm eggs become infective within a few hours after being deposited on the skin around the anus and can survive on objects for 2 to 3 weeks.