Texas GOP Sen. Ted Cruz came perilously close during Tuesday night’s Republican primary debate to having a Rick Perry moment.

Cruz said that if elected president, he would close five federal agencies -- then twice cited the Commerce Department.

Perry, a former Texas governor, ended his 2012 White House bid a couple of months after a debate in which he could not name all of the agencies he would close, if elected.

Cruz, a staunch fiscal conservative, said he would pay for his recently released $500 billion spending plan by abolishing “the IRS, the Department of Commerce, the Department of Education, the Department of Commerce and HUD.”

During a televised primary debate in November 2011, Perry tried to name the three federal agencies he would eliminate but got only as far as naming Commerce and Education.

After fellow GOP contenders tried to help, including suggesting that he perhaps forget the Environmental Protection Agency, a popular conservative target, Perry simply said, “oops.”