in reply to Caesar Cipher
a Caesar Cipher just substitutes each character for a fixed replacement. The easiest way to do that in Perl is with the tr operator:
use 5.010; use warnings; my $original = lc "Ceterum censeo Carthaginem esse delendam"; my $cyphered = $original; $cyphered =~ tr/a-z/k-za-j/; say $cyphered; my $decyphered = $cyphered; $decyphered =~ tr/k-za-j/a-z/; say $decyphered;
|
|---|