West Ham, who have now won successive top flight fixtures for the first time since January 2017 following Saturday's 3-0 away defeat of Newcastle United, moved up to 12th in the table on 18 points from 15 games while Cardiff stayed 16th on 11 points.
Both sides missed several chances in a balanced first half before Joe Ralls squandered a gilt-edged opportunity to fire Cardiff ahead, when West Ham keeper Lukasz Fabianski easily smothered the midfielder's tame penalty kick.
That proved to be a turning point as substitute Perez, who came on for the injured Marko Arnautovic in the 40th minute, swung the contest West Ham's way with two quick goals shortly after the break.
Perez volleyed past visiting keeper Neil Etheridge in the 49th minute after Robert Snodgrass took advantage of a defensive mix-up and then doubled the home team's lead in the 54th with a crisp finish which capped a fine move down the left flank.
Michail Antonio sealed West Ham's victory on the hour when he headed home a Snodgrass corner at the near post and Etheridge made several fine saves before the Josh Murphy nodded in a stoppage-time consolation for the Bluebirds.
Read the full story on supersport.com