summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/cryptogram.pl12
1 files changed, 12 insertions, 0 deletions
diff --git a/bin/cryptogram.pl b/bin/cryptogram.pl
new file mode 100644
index 0000000..d81c15e
--- /dev/null
+++ b/bin/cryptogram.pl
@@ -0,0 +1,12 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Games::Word qw/random_permutation/;
+
+my $alphabet = 'abcdefghijklmnopqrstuvwxyz';
+my $key = random_permutation $alphabet;
+print "KEY: $key\n";
+print "MESSAGE:\n";
+my $text = join ' ', @ARGV;
+eval "\$text =~ tr/$alphabet/$key/";
+print $text, "\n";