There's more than one way to do things PerlMonks

### Perl Solves Fermilab Mystery

by Starky (Chaplain)
 on May 20, 2008 at 08:55 UTC ( #687550=CUFP: print w/replies, xml ) Need Help??

A recent Slashdot article discussed a mysterious letter received by Fermilab containing what appeared to be a coded message.

Two enterprising cryptologists recently deciphered the message. Of the two, one posted the code used to decipher the message, written (as you might expect since you're reading it here) in Perl.

It's a nice snippet, and he earned even greater admiration from this humble monk for taking the care to use warnings and strict. It took him 29 lines, and was obviously written for clarity and not brevity. How many would it take you?

Replies are listed 'Best First'.
Re: Perl Solves Fermilab Mystery
by grizzley (Chaplain) on May 20, 2008 at 12:07 UTC
How many would it take you?

You shouldn't ask such questions... :)

```#!perl -l
use strict;
use warnings;
use Algorithm::Permute;

my \$base = 3;
my @chunks = map{ [/./g] } \$ARGV[0]=~/\d{\$base}/g;
my \$p = new Algorithm::Permute([0..\$base-1]);
while(my @res = \$p->next)
{
print "(", @res, ") ",
map { chr(64 + \$base**2 * \$res[\$base-\$\$_[0]] + \$base * \$res[\$b
+ase-\$\$_[1]] + \$res[\$base-\$\$_[2]]) } @chunks
}

And there is still much to improve. E.g. Math::BaseCnv

Re: Perl Solves Fermilab Mystery
by zentara (Archbishop) on May 20, 2008 at 13:20 UTC
Of course, it's email spam selling Viagra for Aliens..... didn't even need code to figure that out.

The mysterious sets of 1 to 3 bars is nothing more than them tracking the number of hours per active use....... if you hit 4 bars you need to seek professional help immediately.

Its a little known fact, that most ufo crashes are caused by aliens oogling earth girls, and their session goes over 4 hours. :-)

I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re: Perl Solves Fermilab Mystery
by perrin (Chancellor) on May 21, 2008 at 03:45 UTC
Nice to see some clear, well-formatted perl code showing up on Slashdot. The variable names are pretty weak, but otherwise it's a good effort.

Create A New User
Node Status?
node history
Node Type: CUFP [id://687550]
Approved by moritz
Front-paged by grinder
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2017-06-29 09:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
How many monitors do you use while coding?

Results (657 votes). Check out past polls.