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


in reply to Yet Another Rosetta Code Problem (Perl, Ruby, Python, Haskell, ...)

Allow me to add my favorite Perl 6 solutions. The split version is not tested yet because Pugs::Compiler::Rule doesn't seem to implement <before> and <after>:

my $s = "ZBBBCZZ"; my @list = $s.comb: rx/(.)$0*/; # or if you are very fond on split: my @list = $s.split(rx/<after (.)><!before $0>/);

The comb-Version seems to be the same as the ruby example, the split-Version shows off the new regex syntax ;-)