in reply to Re: Re: Re: Re: Matching First Character of Strings Efficiently
in thread Matching First Character of Strings Efficiently
Additionally, it isn't that ord works better with only one character as an argument - it is that the other two are doing a lot more work. Using substr or split to get the first character is extra operations that are completely un-necessary. The ord function (perldoc -f ord) would work the same if it was a single character or a long string. It is for this reason that the second two tests take more time. They are doing un-necessary work.
I hope this clears things up - L~R
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: Re: Matching First Character of Strings Efficiently
by kral (Monk) on Mar 16, 2004 at 20:13 UTC |