You've got to get all twenty seven out (MLB) without anyone reaching base for a perfecto. Doesn't matter if you turn a double play after a walk it isn't a perfect game any more.
For example there was a game where the leadoff man was walked, caught stealing second and then the next 26 in a row were set down. It was not considered a perfect game, but was considered a combined no-hitter. (The starter was tossed after walking the leadoff hitter and arguing the call.)