$a =~ s/(.)\1+/$1/g; [download]
In reply to Re: How to avoid the duplication in a string by ccn in thread How to avoid the duplication in a string by soubalaji