Perl Monk, Perl Meditation | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Your benchmark is flawed. On the first iteration of the testing, your $toto variable has all of its '+' characters changed to ' ' (space) characters. After that, all subsequent iterations and tests are acting upon the "fixed" string, and thus, they basically have no more work to do other than their own internal overhead.
For your benchmark to gain validity, you'll need to make a copy of $toto, to act upon, inside each test, so that the original $toto is always in its original condition. Or declare and define $toto inside of each individual sub being tested.
Dave In reply to Re: Re: Difference between tr// and s///?
by davido
|
|