Method of comparison equations for cosmological perturbations