There’s no such as a perfect lens. Every lens has optical flaws to a greater or lesser extent. Every lens is a compromise between size and weight, complexity of construction, and ultimately, cost. There are three main problems associated with lenses: vignetting, distortion, and chromatic aberration. Fortunately, it is possible to correct all three, either in-camera or in post-production after shooting.
Vignetting is a darkening of the corners of an image, and is typically seen at its worst when a lens is used at its maximum aperture. When the aperture is made smaller, vignetting is typically reduced or is completely removed. Vignetting is one of those problems that you may not even notice. Sometimes it is even beneficial, as it helps to emphasise the brighter centre of the photo. (Which is often where the subject will be.) Cameras generally have a vignette removal option, set in the Shooting menu. (The vignetting discussed here is not the same as mechanical vignetting. This occurs when the edges of a filter or lens hood are seen in the photo. Mechanical vignetting cannot be removed automatically and would have to be cloned out in post-production.)

Lens distortion causes what should be straight lines in a photo to look curved. There are two types of lens distortion: barrel and pincushion. Barrel distortion causes lines to curve out towards the edge of the frame; pincushion causes inward curvature towards the centre of the frame. As with vignetting, you often will not notice lens distortion, particularly if you shoot mainly people or animals. It only generally becomes problematic when shooting geometric subjects such as architecture. If a prime lens does exhibit distortion it will either be barrel or pincushion. However, zoom lenses – which are more optically complex – often suffer from barrel distortion at one end of the zoom range and pincushion at the other end. As with vignetting, barrel distortion can also be cured either in-camera, or later in post-production.
Chromatic aberration is caused when a lens cannot focus the various wavelengths of light at the same point on the sensor. The result is purple/green or red/cyan fringing around high contrast edges in a photo. As lens technology improves, chromatic aberration is gradually becoming less of a problem. Some modern lenses effectively have no chromatic aberration at all. There are two types of chromatic aberration: axial and transverse. Axial chromatic aberration is generally only seen when the aperture of a lens is at maximum, and is visible across the entire image. Axial chromatic aberration disappears as the aperture is made smaller. Transverse chromatic aberration only seen at the edges of an image, and is not reduced by making the aperture smaller. Typically it is transverse chromatic aberration that can be corrected in-camera. Axial chromatic aberration requires a fix in post-production if it mars an image.
Lens flare
Lenses are a wonder of design and technology but they can suffer from a problem known as lens flare. This is seen as odd streaks and coloured shapes across the image, and can also cause a loss of contrast in the image too.
Lens flare is caused when light from a point light source is reflected and bounced around the various glass elements inside a lens. (A point light source is a relatively small light, such a streetlight, or the sun.) The light source does not necessarily need to be within the frame; lens flare can occur when the light is just out of shot, particularly if a lens has a bulbous front element. There are several ways to reduce the risk of lens flare. The first is to keep the glass at the front of the lens as clean and as free from dirt or grease or possible. Fitting a lens hood to a lens can help too. (Though this will not prevent flare from a light within the image space.) Sometimes, however, it is impossible to use a lens hood, such as when a filter holder is fitted to the lens. In this situation a well-placed hand or shade will work well. The key is to keep the hand or shade out of the shot!
