in reply to tr faster than eq?

FYI...
tr///; is also faster then s///; for replacement. Limit on this being that tr does not remove characters therefore if your intent is too remove matching pattern then s/// must be used but if a simple change is desired then tr/// should be used.

Replies are listed 'Best First'.
Re^2: tr faster than eq?
by davido (Cardinal) on Mar 11, 2005 at 06:33 UTC

    Of course if your intent is to remove matching pattern the s/// operator should be used; the reason is that s/// is capable of operating on patterns, and tr/// is not. tr/// operates on characters, not patterns. However, it's incorrect to say that tr/// can't remove characters. That's exactly what the /d modifier is for.


    Dave