Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Caesar Cipher

by moritz (Cardinal)
on Aug 04, 2013 at 19:43 UTC ( #1047821=note: print w/replies, xml ) Need Help??


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;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1047821]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (11)
As of 2016-09-29 13:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (552 votes). Check out past polls.