HARRISBURG, Pa. — Portland knuckleballer Charlie Haeger won a matchup of former major league pitchers, beating Oliver Perez and the Harrisburg Senators 4-1 Tuesday night at Metro Bank Park.

Haeger, who has pitched with the Dodgers, Padres and White Sox, improved to 4-0 with Portland, allowing two hits and four walks in eight innings while striking out nine. He retired 12 batters in a row in one stretch and did not allow a hit until the fifth inning.

Haeger survived a rough first inning when he walked the bases full before striking out Derek Norris and Tim Pahuta to end the threat.

“He definitely had a feel for the knuckleball tonight,” said Portland Manager Kevin Boles. “It was dancing like Justin Timberlake. He was able to change speeds with it.”

Even catcher Dan Butler, who’s familiar with Haeger’s knuckler, had some issues.

“That’s when you know he’s throwing it well,” Boles said. “He was able to spot his fastball, too, and mix it in for effect. He got them off balance a little bit and really did a tremendous job for us.”

Ivan Rodriguez, in Harrisburg on an injury rehab assignment, also was impressed with Haeger’s knuckleball.

“He was dancing all over the place. In a situation like that, you just have to tip your cap,” Rodriguez said.

Perez, a former Met, Pirate and Padre, lasted just 32/3 innings and threw 88 pitches. He allowed four hits and four walks in taking the loss.

The Sea Dogs did most of their damage with a three-run first inning. After Alex Hassan and Mark Wagner walked, Reynaldo Rodriguez cleared the bases with a three-run homer.

It was the eighth of the year for Rodriguez, who added a double while ending a 4-for-28 slump in his last eight games.

Portland added a run in the seventh on a home run by Hassan.

The victory was the Sea Dogs’ fifth in their last six games, all on the road.

“Our guys are gamers,” Boles said. “They keep playing the game the right way and keep going after it every day. They’re trying to finish up strong.

“They want to make an impression at the end of the year. The character of this club we’re really happy with how they’re playing.”