Porcupines have quills as its evolutionary defensive mechanism against predators and threats. The presence of quills on is skin primarily deter a predator from touching and physically harming the porcupine. These also play a significant role in deterring predators from making the animal appear much larger and harder when compared to its actual size and physical toughness.
The quills of the porcupine are like modified hair, made up of the same material, that is, keratin. Quills are actually coated with thick plates of keratin that gives them their hard and sharp quality, and are embedded deep in the skin muscle layer.
Contrary to the old belief, porcupines cannot throw the quills at a potential target. There is no evidence to support this notion. However, the quills are rather easily detached from the bodies when touched, which explains why sometimes animals have them pierced in parts of their bodies and that could perhaps give the impression of porcupines shooting their quills at the intruder.
It is for this purpose that quills prove to be a very good defensive deterrent, as they are difficult to remove once they pierce the body of another animal. Quills in some varieties are covered with scales and pointed barbs, which is why they can prove to be troublesome for the animals that come into contact with them. But thankfully for the porcupine, it can grow back the quills it loses.
The quills on a porcupine actually occur in clusters in the Old World Hystricidae family, while they grow alongside fur, hair and bristles in the New World Erethizontidae family. The latter is the largest of porcupines is the only variety that is the native to North America and may have as many as 30,000 quills on its body. Quills of some porcupines, such as that of the crested porcupine found in Africa, could be as long as a foot.