http://qs321.pair.com?node_id=9400
Category: cryptography
Author/Contact Info ergowolf
Description: creesy ROT13 or caeser encryption. This was one of the first programs I wrote on my own. It does not preserve case.
my $text;
my $type;

# This section grabs the text from the user and converts to lower case
+.
print "Please enter the text you would like to encrypt:";
chomp($text = <STDIN>);
$text =~ tr/A-Z/a-z/;

# This section lets you pick the type of encryption you would like to 
+use.
print "Please enter c for Caesar or r for ROT13 encryption: ";
chomp($type = <STDIN>);
$type =~ tr/A-Z/a-z/;

# This section uses the encryption you chose.
if ($type eq c) {
    $text =~ tr/c-za-b/a-z/;
}
if ($type eq r) {
    $text =~ tr/n-za-m/a-z/;
}
print $text;