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