Texas Gov. and onetime Republican presidential frontrunner Rick Perry suffered a major embarrassment at Wednesday night's  debate when he couldn't remember the name of all the government agencies he would eliminate if he became president.

I will tell you, it is three agencies of government when I get there that are gone: Commerce, Education, and - what's the third one there? Let's see, Perry stopped mid-sentence, invoking laughter.

Texas Rep. Ron Paul was of little help who suggested Perry should actually eliminate five departments, to which Perry answered: Five. Okay. Commerce, Education, and the --

At this point someone suggested EPA, the Environmental Protection Agency, to Perry to which he answered: EPA. There you go.

The CNBC debate moderator John Harwood nudged Perry for an answer, expressing doubt whether it was actually the EPA Perry was thinking about. Perry said: No, sir, no, sir. We are talking about the -- agencies of government -- EPA needs to be rebuilt.

By then the disastrous memory loss had reached an unredeemable stage. The moderator pushed for an answer again: You can't -- you can't name the third one?

It was at this point that Perry understood he'd better end it: Commerce and, let's see. I can't. The third one, I can't. Sorry. Oops.

By the time Perry was called on again, he had remembered what he was talking about, 15 minutes back: That was the Department of Energy that I was reaching for a while ago

Perry's historic embarrassment, rather unprecedented in U.S. presidential debates, has already become a search term on YouTube.

According to Peter Hamby of CNN, Perry showed up at the spin room after the debate and told reporters, I'm sure glad I had my boots on because I sure stepped in it out there.

Damage control measures included Perry's spokesman Ray Sullivan telling CNBC, Every modern president has had a gaffe and argued that the governor still named two more federal agencies to eliminate.

Watch Video: