Skip to content

Instantly share code, notes, and snippets.

@guipn
Created May 7, 2011 18:45
Show Gist options
  • Save guipn/960721 to your computer and use it in GitHub Desktop.
Save guipn/960721 to your computer and use it in GitHub Desktop.
Perl: 13 line ROT-13
#
# 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