Contrastive Perplexity for Controlled Generation: An Application in Detoxifying Large Language Models