In a country geographically diverse as Peru, there are a variety of climates in every each one of the 3 regions that conform it.
Coast: the temperature reaching 28 ºC during summer season (December-April) and at the rest of the year can descends to 14 ºc with a 90% of humid.
Highlands: The rainy season is from December to April (during summer). From May to November it is sunny all day long except at the nights with the temperature drops and you can experiment a pretty intense cold, even though it is consider the best season of the year to visit the different tourist attractive of the highlands of Peru.
Jungle: the weather is tropical (hot, humid and rainy) and the annual temperature exceed the 30ºC.
In general you can visit Peru any time of the year. However the time that is most recommends is the dry and at the same time the cooler season which is from May to November. June, July and August are the most popular months to visit so you will find a consider much larger amount of crowds during these months.
In the wet season (December to April), if you are considering go the highlands specifically you can expect, at least it rains with intensity almost 3 times a week. And it is the season that offers in much less quantity of travelers.
*The Inca trail season is open from March to Jan (February is closed), due to the intense rains in that period of the month. The best time to do the trekking is from April to October; however it is possible that rains at any time of the year. Also June, July and august are the highest seasons.