in reply to Re: Elegant way to split into sequences of identical chars? (while //g)
in thread Elegant way to split into sequences of identical chars?
(The for loop confused me.)use strict; use warnings; use Data::Dumper; print join " ", splitSameChars('xx556xx'); sub splitSameChars { my $letters = shift; push @_, $1 while $letters =~ /((.)\2*)/g; @_; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Elegant way to split into sequences of identical chars? (for)
by tye (Sage) on Nov 30, 2005 at 15:50 UTC | |
by tphyahoo (Vicar) on Nov 30, 2005 at 16:01 UTC | |
by tye (Sage) on Nov 30, 2005 at 16:47 UTC |