in reply to Re: The indisputable speed of tr///
in thread The indisputable speed of tr///

The problem about only reading the first line of the string was raised and fixed in the first post of this thread.

Your solution doesn't work. For example,
print(rot13s(rot13s('AN')), "\n");
prints 'AA' or 'NN' (depending on the hash ordering), but not the expected 'AN'.

You also don't escape the keys and value of %rot as you should. The OP said this is a simplification of his problem, so the presense of punctuation in %rot is likely.

Refer to an earlier post of mine for a working solution using eval to build a substitution and a working solution that uses substitution without using eval.

"[rot13s] is only 52 times slower than [rot13tr]" makes no sense. I think you meant "rot13tr is only 52 times faster than rot13s".

*Only* 52 times faster? So if rot13tr takes 30 seconds — The OP said he had lots of data to process — rot13s takes *only* 26 minutes? I wish my 30 minutes drive home every night only took 30 seconds.

Replies are listed 'Best First'.
Re^3: The indisputable speed of tr///
by Ieronim (Friar) on Jun 28, 2006 at 18:16 UTC
    yes, i was wrong :) i forgot that i at first substitute all A to N and then all N to A, INCLUDING those A's which were already mapped to N :))