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


in reply to Efficient run determination.

Here's the no regex simple iterator version. Just for comparison as I suspect that there is a faster method.
use Data::Dumper; my $string =' aaaa bbbbccccccccbbbb aaaabbbbbcdddddddddddddddd +dddd'; my (@res, $c, $p, $i); $p = 0; $c = substr($string,$p,1); for ($i=1; $i<length($string); $i++) { next if ($c eq substr($string,$i,1)); push (@res, [$c,$p,($i-$p)]); $c = substr($string,$i,1); $p = $i; } push (@res, [$c,$p,($i-$p)]); Dumper (\@res);

Dingus


Enter any 47-digit prime number to continue.