Phineas and Ferb The Movie: Across the 2nd Dimension

This section's plot summary may be too long or excessively detailed. Please help improve it by removing unnecessary details and making it more concise. (July 2015) (Learn how and when to remove this template message)
Phineas and Ferb are celebrating the fifth anniversary of when they got their pet platypus, Perry. In commemoration, they create a giant shuttlecock and robotic replica figure of Perry to play an improvised game of badminton. However, when Perry's hovercraft accidentally collides with their shuttlecock, the boys crash into Dr. Heinz Doofenshmirtz's laboratory and destroy his "Other-Dimension-Inator", which is designed to help him travel to parallel dimensions. Intrigued by the idea, the two help Doofenshmirtz rebuild the machine, while Perry arrives on his mission to stop Doofenshmirtz. Unwilling to give away his secret identity to the boys (which would get him relocated to another family), Perry reverts to his pet mode and is forced to watch them help Doofenshmirtz activate his invention.
The group is transported to an alternate dimension where a second, truly intelligent and evil Doofenshmirtz rules over his Tri-State Area. The second Perry (known as Platyborg), was converted into an evil cyborg by Doofenshimrtz-2 and programmed to serve as his second-in-command and general of his army of Norm-Bots. When the boys arrive with Perry to Doofenshmirtz-2's office, Doof-2 recognizes Perry as a secret agent and orders Platyborg to attack Perry. When that doesn't affect him, Doofenshmirtz-2 orders Platyborg to attack the boys next, which forces Perry to reveal his secret identity to stop Platyborg from doing so, much to the others' shock. Doofenshmirtz-2 then sends several of his Norm Bots to catch Perry and the boys, but the trio escapes. Afterwards, Phineas expresses his anger at Perry for using him and Ferb as a cover for his double life.
After seeing that their remote for the portal is broken, the boys find their alternate selves, who are shown to have grown up without knowing about summer. Meanwhile, Doofenshmirtz-2 lectures Doofenshmirtz of his incompotence and lack of ability to distinguish Perry from his agent mode to his pet mode. Doofenshmirtz-2 then decides to use the Other-Dimension-Inator to lead an attack on the original Tri-State Area, despite his frustration with Doofenshmirtz for his annoying behavior. In order to keep Perry off the track, he publicly announces for Perry to turn himself in so that he will spare Phineas and Ferb. Upon seeing this on television, Perry agrees to turn himself in. However, as Perry tries to sneak off, he is caught by Phineas and Ferb, who are still infuriated by his secret life and disown him for it, allow him to leave.
Perry turns himself in as promised, but when Doofenshmirtz learns that he can't fix the Other-Dimension-Inator without the help from the boys, Doofenshmirtz-2 reneges on the deal. Meanwhile, Phineas and Ferb go to the alternate Isabella for help with their remote and find that she, along with the alternate selves of Baljeet, Buford, and the Fireside Girls are part of the resistance movement led by the alternate Candace. Baljeet-2 is able to open the portal to the original dimension, but upon learning about Perry's capture, Phineas and Ferb decide to rescue Perry back before they can leave. In the original dimension, Candace spots the portal and jumps through it, causing it to close off.
Using the underground tunnels, the kids head over to the prison, but are trapped by Doofenshmirtz-2 and his forces. They are able to escape with Perry by providing a distraction, but during the chase, Platyborg disables one of the mine carts, slowing them down. Knowing that she can't save Phineas, Ferb, Candace, and Perry without endangering her brothers, Candace-2 is forced to abandon them. Doofenshmirtz-2 orders the boys to fix the machine, but as they refuse, they inadvertently remind Doofenshmirtz what they did to fix the machine: removing the self-destruct button. After Doofenshmirtz powers up the machine, Doofenshmirtz-2 orders Phineas, Ferb, Candace, and Perry to be fed to a monster called the Goozim; when Doofenshmirtz annoys him again, Doofenshmirtz-2 orders him to be fed as well, much to the former's shock.
Before the five could be fed, however, Candace-2 rescues them and gives them the remote, allowing Phineas, Ferb, Candace, Perry, and Doofenshmirtz to escape to go through other dimensions to escape until they reach their dimension. Despite this Candace-2 is captured by the Norm Bots. Using the Other-Dimension-Inator, Doofenshmirtz-2 arrives at theirl dimension as well, and releases the Norm Bots into Danville. Perry gives Phineas and Ferb the locket off his collar before running off. Returning home, they find that the locket was given to them so they could find Perry's lair. There, they find that replicas of all their inventions are stored inside. With the help of their friends, the children of Danville, and the O.W.C.A. agents, Phineas and Ferb use the inventions to battle the Norm Bots.
Meanwhile, Candace-2 is freed by Phineas-2, Ferb-2, and Jeremy-2. In the original dimension, Phineas and Perry confront Doofenshmirtz-2 and Platyborg. Perry manages to defeat Platyborg by sending him to fry on an electric socket while Phineas is able to destroy the satellite controlling the Norm Bots, causing them to deactivate as Ferb arrives. Doofenshmirtz-2 brings out a large robot version of himself, preparing to kill Perry, Phineas, and Ferb with it, but Doofenshmirtz arrives and gives him a toy train that Doofenshmirtz-2 lost when he was a kid, which was the sole reason he turned evil. With his tragic upbringing resolved, Doofenshmirtz-2 self-destructs his Norm Bots and returns to his own dimension, only to be arrested and taken into custody.
Several characters from the other dimension arrive in the original dimension, thanking their counterparts for saving the day. Before they leave, Platyborg reverts to his normal self as Perry-2, having been freed from his evil programming, and Phineas-2 and Ferb-2 take him home. Later on, the kids are distraught to learn that Perry will be relocated since his cover is blown, but Carl remembers Doofenshmirtz once built an Amnesia-Inator that can erase memories. As a result, Phineas, Ferb, Candace, and their friends have their memories erased so they can keep Perry. Before so, Isabella sees an opportunity and kisses Phineas, leaving him surprised, but very happy. Later on, Perry enters his lair, uploads photos from the day onto his computer, smiles happily at them, and saves them.

Question: Who catches Perry as he tries to sneak out ?
Answer: Phineas and Ferb catch him when he tries to sneak out.