The two appeared with six other Republican White House hopefuls in the ninth GOP debate, which generally focused on financial issues and how to repair the ailing U.S. economy.
Asked to address the sexual-harassment accusations that have consumed his campaign for most of two weeks, Cain dismissed them as "character assassination" and said voters wanted to move on.
"The American people deserve better than someone being tried in the court of public opinion based on unfounded accusations," he said to cheers from the Republican audience.
"I value my character and my integrity more than anything else," Cain said.
Former Massachusetts Gov. Mitt Romney -- who told ABC News Tuesday he considered the allegations serious -- refused to go further into the matter when was asked if he would fire Cain if he were his boss and hear heard Cain was accused of harassing four women.
"Look, look, Herman Cain is the person to respond to these questions," Romney said. "He just did. The people in this room and across the country can make their own assessment."
On the economy, Perry said he would shut down three government agencies if he were president. But as he began to list them, he could think of only two.
"Commerce, Education and the -- what's the third one there? Let's see," Perry said, pausing.
After a rival suggested the Environmental Protection Agency, Perry acknowledged he couldn't name the third agency.
"Oops," he said.
Several minutes later he said, "By the way, that was the Department of Energy I was reaching for a while ago."
On other economic issues, Romney said Washington should resist all calls to get involved in any form of bailout tied to the European debt crisis.
"Europe is able to take care of their own problems," he said.
Rep. Ron Paul of Texas said European debt had to be "liquidated" to right the economy, while former Utah Gov. Jon Huntsman said Europe's troubles were a taste of what the United States would face if the president and Congress did not restrain government spending.
Romney was asked separately about his reputation for bending to suit the prevailing political winds, and whether voters can be persuaded his positions were rooted in something more than ambition.
"I think people know me pretty well," Romney said eight weeks ahead of the Iowa caucuses. "I think people understand that I'm a man of steadiness and constancy. I don't think you are going to find somebody who has more of those attributes than I do."
He explained to the suburban Detroit audience he consistently opposed the 2009 auto industry bailout.
"Whether it was by President [George W.] Bush or President [Barack] Obama, it was the wrong way to go," Romney said. "I said from the very beginning they should go through a managed bankruptcy process."
Former Sen. Rick Santorum of Pennsylvania pushed his plan to eliminate taxes on manufacturers, saying the proposal would help all sectors of the economy.
Rep. Michele Bachmann of Minnesota said U.S. corporate-tax rates were among the world's highest.
"We have to lower the tax rate because it's a cost of doing business," she said.
Former House Speaker Newt Gingrich, who rose to third among GOP contenders in a USA Today/Gallup Poll released Monday, was pressed on what he did for Freddie Mac to receive $300,000 in 2006, before the housing market imploded.
He denied he was a lobbyist, saying he gave advice as "a historian" to the nation's second-largest mortgage buyer, which its management ignored.
When the topic turned to the Occupy Wall Street protests, Gingrich said the news media were partly to blame for the activism, saying news organizations failed to report accurately on the economy.
Asked for specifics, he said: "I love humor disguised as a question. That's terrific."
He said he had yet to hear a single reporter "ask a single Occupy Wall Street person a single rational question about the economy," including if protesters understood how corporate profits paid for the privately owned New York City park they were occupying.