http://www.perlmonks.org?node_id=1034167


in reply to string manipulation

A slight variation on the split and count solutions.

$ perl -E ' > $str = q{010011100001110110100110111000001}; > say join q{,}, map tr{0}{}, split m{1+}, $str;' 1,2,4,1,1,2,1,5 $

Cheers,

JohnGG