http://www.perlmonks.org?node_id=353097


in reply to Re:^2 Remove repeated characters from a string
in thread Remove repeated characters from a string

This will do that for you:

1 while $string =~ s/(.)(.*)\1/$1$2/g

Replies are listed 'Best First'.
Re^4: Remove repeated characters from a string
by aramisf (Beadle) on Apr 10, 2014 at 18:24 UTC
    This construction with the while loop made my day. Thanks a lot, sir knew! :D