The generalized inverses of perturbed matrices