Eric Krause wrote:
>
Hello all,
I have a string like:
11111xxx11xxxx111111xx11x1xxxx

I would like to replace the 1's with the total of 1's like this:
5xxx2xxxx6xx2x1xxxx

Can anyone please help?

Simply:

  $string =~ s/(1+)/length $1/ge;

HTH,

Rob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to