In regards to an old post about a caesar shift solution, I have tried my skills to approach this in an efficient way and came up with the following:
#!/usr/bin/perl -w # # Caesar shift decrypting script # Author: Aleksandr Melentiev <tzapper@users.sf.net> # Redistributable under the BSD License use strict; use warnings; print "Enter encrypted string:\n"; chomp(my $cipher = <STDIN>); my @alphabet = ('A' .. 'Z'); for (@alphabet) { my $text = $cipher; my $rot = join("", @alphabet); eval "\$text =~ tr/a-zA-Z/$rot/, 1" or die $@; print "ROT: $text\n"; push(@alphabet, shift(@alphabet)); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Caesar Shift
by tachyon (Chancellor) on Aug 25, 2004 at 10:47 UTC | |
Re: Caesar Shift
by belg4mit (Prior) on Aug 25, 2004 at 05:12 UTC | |
Re: Caesar Shift
by mpeg4codec (Pilgrim) on Aug 25, 2004 at 02:53 UTC | |
by Aristotle (Chancellor) on Aug 25, 2004 at 14:31 UTC |
Back to
Cool Uses for Perl