A simple regular expression makes it easy:
use strict; use warnings; my $str = "Foooboooobaaar"; $str =~ s/(.)\1+/$1*/g; print "\n$str";
Prints:
Fo*bo*ba*r
In reply to Re: Replace repeated characters with *
by GrandFather
in thread Replace repeated characters with *
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |