summaryrefslogtreecommitdiffstats
path: root/bin/cryptogram.pl
blob: e965af764b90adb2589b485d282fc3b00e30ce7d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env perl
use strict;
use warnings;
use Games::Word qw/random_permutation/;
# PODNAME: cryptogram.pl

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";