Created
May 7, 2011 18:45
-
-
Save guipn/960721 to your computer and use it in GitHub Desktop.
Perl: 13 line ROT-13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Perl - ROT-13 | |
# | |
# guidjos | |
use warnings; | |
use strict; | |
die "\n\n\t $0 [-e | -d] [text]\n" unless @ARGV > 1; | |
my $option = shift; | |
my $_ = join " ", @ARGV; | |
my $key; | |
die "\n\n\tOption is \"-e\" (encrypt) or \"-d\" (decrypt)\n\n" unless $option eq "-e" or $option eq "-d"; | |
$\ = "\n\n"; | |
print "\n\n\t"; | |
$key = "nopqrstuvwxyzabcdefghijklm"; | |
$option eq "-e" and eval "tr/a-z/$key/;"; | |
$option eq "-d" and eval "tr/$key/a-z/;"; | |
print; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment