Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: global match except last one

by jpl (Monk)
on Jul 12, 2011 at 18:16 UTC ( [id://913975]=note: print w/replies, xml ) Need Help??

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/_$//
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://913975]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-24 18:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found