Advice on dealing with internet trolls?

Does anyone have some good advice for me in how to deal with “trolls”, a.k.a. somebody that annoys you on the internet?

Although I definitely have grown wiser over the years, I still sometimes react like “OMG! Sombody on the internet is WRONG!”

What do you do to refrain from entering in a flame war or turd-throwing contest when you get annoyed by someone on the internet?