I was playing Borderlands 2 and realized that Marcus gives you a slag weapon to test. I've always wanted a slag weapon, however, I also want the XP. Is there a way to get the XP and keep the weapon?
You get that mission when you first get to Sanctuary, but elemental weapons are rare at that stage. I think it's deliberate - you get the elemental tutorial before you've come across too many elemental weapons.
Don't worry about giving up the slag weapon - there will be plenty more as you level up.
In a couple of missions you'll find a similar introduction to e-tech weapons.
If you really want to keep the gun bear in mind that it will be replaced by much better kit when you're a few levels higher, so you could just take it, use it, and then when you find a better slag gun turn in the Marcus mission.