summaryrefslogtreecommitdiffstats
path: root/bin/cryptogram.pl
blob: d81c15e74e04f8def1afd2c5b104301673d3f836 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
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";