This article is from the Photographic Lenses FAQ, by David Jacobson with numerous contributions by others.
It doesn't; it is subject distance that affects perspective. However, a longer lens provides more subject magnification at a given distance, so you can get farther from your subject without having the image be too small. By moving back, you make the magnification ratio between the front and back of your subject smaller, because the distance ratio is closer to one. So, in a portrait, instead of a nose that's magnified much more than the rest of the head, the nose is magnified only very slightly more than the rest of the head, and the picture looks more pleasing.
You can get the same perspective with a shorter focal length lens by simply moving back, and enlarging the central portion of the image. Of course, this magnifies grain as well, so it's better to use a longer lens if you have one.