Accurately locating the studs or at least one stud is critical.
The first pegboard mounted will determine the rest of the layout.
For that reason, I started in the middle.
The pegboard screw holes are 3/4 inch apart from one panel to another.
A 2X4 stud is only 1-3/4 inches wide.
That only leaves half an inch to spare on each side.
A magnet can locate a nailhead or drywall screw in a stud
but it may not be in the center of the stud.
Explore the sheetrock with a nail or small drill bit to find the sides of the stud.
With luck, the studs will be 16 inches on center. You may want to check first.
Mark the center of the stud and measure and mark 3/8ths of an inch each side.
Punch the sheetrock with a nail to set the drill bit.
Drill pilot holes with a 1/8th inch bit into the stud.