Help for this page

Select Code to Download


  1. or download this
    use Benchmark('countit');
    
    ...
    $t = countit(5, '$str="BuyACaseOfCamels";' . $code);
    $count = $t->iters ;
    print "$count loops of $code\n";
    
  2. or download this
      perl ccase.pl
    1686588 loops of $str =~ s/(?<=[a-z])(?=[A-Z])/_/g
    ...
    1760558 loops of $str =~ s/(?<=[a-z])(?=[A-Z])/_/g
    1336044 loops of $str =~ s/([a-z]+)(?=(.?))/ $1 . (length($2) ? "_" : 
    +"") /ge
    1492832 loops of $str =~ s/([a-z]+)/$1_/g; $str =~ s/_$//