in reply to Best method for matching strings

I would think index() would be the fastest, though a benchmark is at hand. Check out perldoc -f index.

UPDATE:

I must say, I do find it irritating when people post first, are wrong and then modify their post to be an almost direct copy of another post. My suggestion was new, because the first reply by friedo had suggested using substr rather than index. After my post he had changed his. If you want to change your viewpoint/modify your stance on a subject, than at least state that you have UPDATE(d): your node.


Evan Carroll
www.EvanCarroll.com

Replies are listed 'Best First'.
Re^2: Best method for matching strings
by sauoq (Abbot) on Nov 07, 2005 at 01:37 UTC
    If you want to change your viewpoint/modify your stance on a subject, than at least state that you have UPDATE(d): your node.

    Ahem... ;-)

    -sauoq
    "My two cents aren't worth a dime.";
    
Re^2: Best method for matching strings
by friedo (Prior) on Nov 06, 2005 at 23:35 UTC
    My apologies, EvanCarroll. I do usually post an UPDATE when I change a node, but as that was a quick brainfart I immediately changed it from substr to index. Since I changed it within a minute or so of realizing my blunder I didn't feel the need to inform the world of my stupidity.
      All is good, no grudges held. As the adage goes, "happens to the best of us."


      Evan Carroll
      www.EvanCarroll.com