Most Nymphalid butterflies, a group of large species that include the Peacock, Painted Lady, Comma and the Monarch, have modified forelegs, smaller than the rest of the legs and normally tucked in under the head. In the Peacock (above) the forelegs are relatively large, but not used for walking and they even have the same dark colour as the body, giving the impression that the butterfly has only four legs. Why is this? Despite their vestigial appearance, experiments have shown that the forelegs have a very important function, especially in females. In the investigated Nymphalid species (mainly the Monarch and the Queen butterfly), the tips of the reduced forelegs in females - but not males - have sensory organs associated to spines, which they use to recognise specific chemicals from the larval foodplant when ovipositing. They drum the leaves with their forelegs, puncturing the leaves and releasing plant chemicals allowing their receptors to detect them (what is known as contact chemorreception). The antennae and the tips of the other legs also contribute to selecting the foodplant, with tapping with the antennae and drumming with the mid legs also observed when selecting foodplant. The forelegs are part of a very complex sensory system, possibly providing a 'backup' with the sensory spines protected from damage, by the forelegs being reduced and not being used for walking. Butterflies can be very selective in choosing foodplants, as they not only have to determine the species of plant, but also how healthy or how old the leaves are, so it is not surprising that they use a complex sensory system to assess this, which we are only beginning to understand.
This video from Arkive, shows a female Peacock tapping a nettle leaf with its forelegs while laying eggs.
Baur, R., Haribal, M., Renwich, J. A. A. and Staedler, E. (1998). Contact chemoreception related to host selection and oviposition behaviour in the monarch butterfly, Danaus plexippus Physiological Entomology, 23, 7-19 DOI: 10.1046/j.1365-3032.1998.2310007.x
Myers, Judith. 1969 Distribution of foodplant chemoreceptors on the female Florida queen butterfly, Danaus gilippus berenice (Nymphalidae)." J. Lepid. Soc 23: 196-198.