Splitting on 1's, then counting with length.
use strict; use warnings; my $string = "010011100001110110100110111000001"; my $newstring = join ",", map { length $_ } split /1+/, $string; print "$newstring\n";
In reply to Re: string manipulation
by hdb
in thread string manipulation
by kimlid2810
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |