Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Elegant way to split into sequences of identical chars?

by pKai (Priest)
on Nov 29, 2005 at 20:49 UTC ( #512768=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub seq1 {
        my $r;
    ...
        push @R, $r if length $r;
        @R;
    }
    
  2. or download this
    sub seq2 {
        my @x = shift =~ m/((.)\2*)/g;
        map $x[2*$_], 0..@x/2-1;
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://512768]
Approved by Paladin
Front-paged by friedo
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2019-05-20 07:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (125 votes). Check out past polls.

    Notices?