in reply to Using a hash to globally s/// a string

Marginally OT: What you're trying to do is NOT "encryption."
It's simple "substitution," readily restored to cleartext with a frequency attack or any one of several other approaches. It's also sometimes called "transposition" (about either, search out "ROT13").

Your options section (at line 87) has another kind of problem: if ($action =~ m/e/i) will cheerfully match on "Decrypt" if the user is careless about reading your instructions.

And at that point, your code got longer than I chose to follow. That's not to be harsh; rather, it's prelude to the PM advice to boil your illustration down to the smallest possible example that actually compiles and illustrates the problem. In this case, you could make your OP considerably shorted by omitting the transposition code.