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