in reply to transliterate

Simple. Tr's faster, because it doesn't have to do all the funky "regex" style matching. Tr just loops through the characters one-by-one, and if it finds a + it changes it to a space. If it doesn't, it doesn't spend any more time figuring out what not to do, whereas s/// will. In other words, s/// is like using a power drill when a screwdriver would do.

Update: Okay, maybe it's not technically faster, but in theory it's supposed to be faster. I'm guessing that the s/// regex command gets more bit-level optimization than anything else in perl, just because it's such a swiss army knife of functionality; maybe tr got left behind on optimization?

"In fact, we must do just the opposite and remain ever-vigilant, striving to ensure that we stop the Urkels of tomorrow before they gain power. Only by demanding full accountability can we reverse the shameful legacy of man's inanity to man."

Replies are listed 'Best First'.
Re: transliterate
by Anonymous Monk on Jul 27, 2001 at 22:07 UTC
    thanks much :)