Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Puzzlement in Splitsville

by thundergnat (Deacon)
on Jun 19, 2005 at 13:33 UTC ( #468115=note: print w/replies, xml ) Need Help??


in reply to Puzzlement in Splitsville

I don't know if it is any more elegant....

push @runs, $1 while 'aaabbcddddaee' =~ /((.)\2*)/g; print "@runs\n";

Replies are listed 'Best First'.
Re^2: Puzzlement in Splitsville
by rir (Vicar) on Jun 30, 2005 at 21:11 UTC
    Update: I misread the question.

    thundergnat's pattern doesn't work for me with my 5.6.1, it puts every character into an element.

    I had: push @ans, $1 while $str =~ /(.{3}|.{1,2}$)/g;

    Be well,
    rir

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2018-10-20 19:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (119 votes). Check out past polls.

    Notices?