Computation of the b-quark mass with perturbative matching at the next-to-next-to-leading order