#!/usr/bin/perl -w use warnings; use strict; use Data::Dumper; $Data::Dumper::Indent = 1; my $pattern15 = '*ObviouslytheyarefoolsTheDesolationneedsnousherItcanandwillsitwhereitwishesandthesignsareobviousthatthesprenanticipateitdoingsosoonTheAncientofStonesmustfinallybegintocrackItisawonderthatuponhiswillrestedtheprosperityandpeaceofaworldforoverfourmillennia'; #$pattern15 = reverse '*ObviouslytheyarefoolsTheDesolationneedsnousherItcanandwillsitwhereitwishesandthesignsareobviousthatthesprenanticipateitdoingsosoonTheAncientofStonesmustfinallybegintocrackItisawonderthatuponhiswillrestedtheprosperityandpeaceofaworldforoverfourmillennia*'; #$pattern15 = "Obviously they are fools The Desolation needs no usher It can and will sit where it wishes and the signs are obvious that the spren anticipate it doing so soon The Ancient of Stones must finally begin to crack It is a wonder that upon his will rested the prosperity and peace of a world for over four millennia"; #$pattern15 = "*Chaos in Alethkar is, of course, inevitable. Watch carefully, and do not let power in the kingdom solidify. The Blackthorn could become an ally or our greatest foe, depending on whether he takes the path of the warlord or not. If he seems likely to sue for peace, assassinate him expeditiously. The risk of competition is too great."; #$pattern15 = "*ChaosinAlethkarisofcourseinevitableWatchcarefullyanddonotletpowerinthekingdomsolidifyTheBlackthorncouldbecomeanallyorourgreatestfoedependingonwhetherhetakesthepathofthewarlordornotIfheseemslikelytosueforpeaceassassinatehimexpeditiouslyTheriskofcompetitionistoogreat"; my $code = '1118251011127124915121010111410215117112101112171344831110715142541434109161491493412122541010125127101519101112341255115251215755111234101112915121061534'; my $idx; my @letters = split '', $pattern15; # Make an array of the paragraph print "Letters used as source: "; foreach my $letter (@letters) { print "$letter"; } print "\n"; my @comb_codes; # The following line splits 2 digits at a time into an array @comb_codes = $code =~ m/(..)/g; # You could put your own splits here #@comb_codes = split ' ', '11 18 25 10 11 12 7 12 4 9 15 12 10 10 11 14 10 21 5 11 7 11 21 01 11 21 7 13 4 4 8 3 11 10 7 15 14 25 4 1 4 3 4 10 9 16 14 9 14 9 3 4 12 12 25 4 10 10 12 5 12 7 10 15 19 10 11 12 3 4 12 5 5 11 5 25 12 15 7 5 5 11 12 3 4 10 11 12 9 15 12 10 6 15 3 4'; print "Numbers used as source: "; foreach my $number (@comb_codes) { print "$number "; } print "\n"; print "Assuming letter one is two digits, offset of 01:\n "; foreach my $code (@comb_codes) { print $letters[$code]; } print "\n"; # For 0 based index, get rid of '*'; shift @letters; print "Assuming letter one is two digits, offset of 00:\n "; foreach my $code (@comb_codes) { print $letters[$code]; } print "\n";