How do I remove consecutive pairs of characters?

To turn "abbcccd" into "abccd":

    s/(.)\1/$1/g;	# add /s to include newlines
Here's a solution that turns "abbcccd" to "abcd":

    y///cs;	# y == tr, but shorter :-)

Back to perlfaq4