Measure the interior walls of your closet. Keep in mind that pegboard comes in standard sizes, like 2-by-4 feet or 4-by-4 feet. If you want to perfectly cover the wall, you will need to buy a larger piece of pegboard and cut it to size.
Mark the pegboard sheet and use a table saw to cut it. Smooth down the rough edge with sandpaper.
Find the studs in your closet wall using an electronic stud finder or by knocking on the wall. Measure the locations of the studs from a side wall and write these measurements down.
Press your pegboard up against the wall. If it isn't covering the entire wall, use a level to make sure that it hangs straight. Use your measurements from earlier to either drive nails or screw through the peg holes and into the studs.
Hang hooks in the peg holes and use them for organizing your closet -- try hanging things like belts, scarves, hats and neckties.