in reply to Replacing with multiple occurrences.

Is there something similar for replacing, something like...
Sure is, just use a bit of back-referencing and an evaluated replacement and you're sitting pretty
my @strs = qw/fooxx baryyyy bazzzzzzz/; s{ ( (.) \2+ ) \z }(substr($1, 0, length($1) / 2))ex, print for @strs; __output__ foox baryy bazaaa
See. perlre for more info.

In case you're working on large strings the above regex would be quite hefty in terms of processing, so here's a version that would perform much better on longer strings

reverse =~ /\A((.)\2+)/ and substr($_, -(length($1) / 2)) = '' for @strs; print map "$_\n", @strs; __output__ foox baryy bazaaa
This is less processor intensive because it only needs to backtrack once, whereas the first regex has to backtrack all the way through the string.
HTH

_________
broquaint

update: added second code example