Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 chanting in the Monastery: (6)
As of 2016-10-01 21:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (8 votes). Check out past polls.