with modern plumbing, it is dog dirt simple. hardware will sell you a flexible pipe that includes valve [if the leak is on the pressure side of the current valve] and simply presses onto the cleaned up copper pipe. all you need to do is cut off the existing pipe at good copper, clean it up [sandpaper works well] and press the new onto the old, then connect to the toilet.
if the copper pipe is absolutely destroyed, it "usually" simply screws into a fitting hidden inside the wall. you just get a length of threaded pipe to replace it and proceed as outlined above.
the worst, i suppose, would be if you've destroyed the copper pipe to the point that it cant be cut off and it uses sweated on joints inside the wall. then you'll want a handyman with some plumbing experience to open up the wall, remove the old fitting [with torch -- care required so you don't fire the house] and put on a new one.