in reply to string manipulation

kimlid2810:

Just for something a little different:

$ cat t.pl my $string = "010011100001110110100110111000001"; $string =~ s/1+/, /g; $string =~ s/(0+)/length($1)/ge; print $string; $ perl t.pl 1, 2, 4, 1, 1, 2, 1, 5,

...roboticus

When your only tool is a hammer, all problems look like your thumb.