Chicago's lead over Detroit in the American League Central was reduced to 1 1/2 games.
Billy Butler's solo shot in the sixth rallied the Royals into a 2-2 tie and Perez came through in the seventh to bring Kansas City its seventh win in 10 games.
Mike Moustakas and Alcides Escobar reached in the seventh on consecutive one-out singles off Chris Sale. After Alex Gordon struck out and with runners on fist and third, Sale walked Butler intentionally to get to Perez.
The double to left by Perez brought home both Moustakas and Escobar to end the scoring.
Sale (14-4) lost for only the second time in his last 15 starts.
Luis Mendoza (7-8) got the win while giving up two runs on four hits in seven innings. He has won back-to-back starts for the first time this year.
Greg Holland retired the first two batters in the ninth, then allowed two base runners before collecting his fifth save.
NBC reportedly holds celebs hostage to Jimmy Fallon's show
Aaron Carter is still in love with Hilary Duff