summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2008-02-02 01:24:36 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2008-02-02 01:24:36 -0500
commit39f2c4429dd46dc12d167ea43126f0d63156bb25 (patch)
tree2f0c7f6f255797f25342c9a9cb91603306ee553f /bin
parent3a5a6804854e68cc30b3065f4492e7f2e08ce235 (diff)
downloadgames-word-39f2c4429dd46dc12d167ea43126f0d63156bb25.tar.gz
games-word-39f2c4429dd46dc12d167ea43126f0d63156bb25.zip
add another example script
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";