Peru has had a lot of bad press but if you use your common sense you’ll be fine. I live in Lima, for example the tourist areas here have a high police presence and are safe.
Peru is ranked 10th in the latest crime index rankings.
https://www.numbeo.com/crime/rankings_by_country.jsp
The bad reputation is justified. It's not cool to go the victim blaming path to avoid acknowledging problems.