Worms don't have eyes as there's isn’t a need for them underground. However because of the deadly drying effect of sunlight, it has been important for them to develop a way of reacting to light. Worms have a highly effective system of light sensors on their skin, connected to their central nervous system. Once exposed to the light it takes only seconds for the worm to burrow down and disappear out of sight.
Worms are quick to burrow when exposed to light.
Have you ever wondered why worms come to the surface when it rains? A common myth is that the worms come to surface to stop drowning. This isn’t true. As we have just discovered worms don’t want to dry out and so when it rains they take the opportunity to move around on the surface without drying out.