Haven’t been recently, but the political situation has calmed down from a year or so ago. With any S. American country there are places in every city, town, or village, where you shouldn’t go and you really need to remain cognizant of your surroundings. Your hotel should be able to tell you where and what to avoid and which modes of transportation are safer. Petty crime is an every day occurrence and in some places, has escalated somewhat. All you can do is minimize the chances of becoming a victim.
I have a whole list of considerations when traveling, but they’d probably scare you into not wanting to travel anywhere, let alone to Peru. Only you can decide what’s safe enough for you.