Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: string manipulation

by johngg (Abbot)
on May 18, 2013 at 23:57 UTC ( #1034167=note: print w/ replies, xml ) Need Help??


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


Comment on Re: string manipulation
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1034167]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2015-07-30 01:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls