in reply to More Efficient Subroutine

I didn't bother to deal with the punctuation characters, as once you understand the following technique, you'll be able to write your own:

$string =~ tr/0-9A-Za-z/a-mN-ZA-Mn-z0-9/;

That's certainly not an exact match for your substitution cipher, but it's a solution of the tr/// type that tilly mentioned.