in reply to Is one form of character substitution better than the other, and if so, why?

For the example you provided the regex approach will run faster and be easier to read. I tend to prefer intuitive code over fast code except when it really matters.

To satisfy your curiosity you can play with the Benchmark module, which turnstep wrote a tutorial for in this node.

As you benchmark more of your code you may find yourself committing one of the cardinal sins - premature optimization.

  • Comment on Re: Is one form of character substitution better than the other, and if so, why?

Replies are listed 'Best First'.
Re^2: Is one form of character substitution better than the other, and if so, why?
by OfficeLinebacker (Chaplain) on Aug 21, 2006 at 17:26 UTC
    Thanks, I have to look into premature optimization...it sounds like the kind of thing about which a woman might tell me "It's OK, it happens to everybody."

    _________________________________________________________________________________

    I like computer programming because it's like Legos for the mind.

      I wouldn't want to be found around women who know what happens to everybody.

      CountZero

      "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law