Is it possible that perl was having to eval the strings each time the sub was called, thus skewing the results?
No, it's because they are evaluated somewhere without access to the lexical $string, so they act upon the undefined global $string. Your solution causes the test cases to be compiled where $string is still in scope.
In reply to Re^2: tr faster than eq?
by ikegami
in thread tr faster than eq?
by Keystroke
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |