![]() |
|
Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Difference between tr// and s///?by Sol-Invictus (Scribe) |
on Feb 06, 2004 at 13:42 UTC ( #327062=note: print w/replies, xml ) | Need Help?? |
my day for benchmarking it seems
Another perl function which out performs regex is index(), for checking for exact matches in textual data:
but obviously there are limitations, with tr// you can't use it on only part of a string and index() only returns the position of the first match of an exact term or character in text data. The extra control and options offered by regex are what make them slower than both these functions in given situations. Update As Davido pointed out the original benchmark tests were flawed and have since been adjusted.
You spend twenty years learning the spell that makes nude virgins appear in your bedroom, and then you're so poisoned by quicksilver fumes and half-blind from reading old grimoires that you can't remember what happens next.
In Section
Seekers of Perl Wisdom
|
|