aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Ferrari <fluca1978@gmail.com>2021-01-25 09:43:15 +0100
committerLuca Ferrari <fluca1978@gmail.com>2021-01-25 09:43:15 +0100
commit81d3148f1c3dc0d85d25fcdb6c5d329f27ca3193 (patch)
tree7166b61c62f376beff1c5e7481b2d91141f0d2e1
parentc2e3d94308259dfeed2f131426c365adb88a9663 (diff)
downloadperlweeklychallenge-club-81d3148f1c3dc0d85d25fcdb6c5d329f27ca3193.tar.gz
perlweeklychallenge-club-81d3148f1c3dc0d85d25fcdb6c5d329f27ca3193.tar.bz2
perlweeklychallenge-club-81d3148f1c3dc0d85d25fcdb6c5d329f27ca3193.zip
Task 1 deon
-rw-r--r--challenge-097/luca-ferrari/raku/ch-1.p619
1 files changed, 19 insertions, 0 deletions
diff --git a/challenge-097/luca-ferrari/raku/ch-1.p6 b/challenge-097/luca-ferrari/raku/ch-1.p6
new file mode 100644
index 0000000000..970bd2379b
--- /dev/null
+++ b/challenge-097/luca-ferrari/raku/ch-1.p6
@@ -0,0 +1,19 @@
+#!raku
+
+
+sub MAIN( Str $S = "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG",
+ Int $N where { $N > 0 && $N < ( 'A' .. 'Z' ).elems } = 3 ) {
+ my @alphabet = 'A' .. 'Z';
+ my %cipher;
+ # my $index = @alphabet.elems - $N;
+ # for @alphabet {
+ # %cipher{ $_ } = @alphabet[ $index ];
+ # $index = $index + 1 < @alphabet.elems ?? $index + 1 !! 0 ;
+ # }
+
+ %cipher{ @alphabet[ $_ ] } = @alphabet.rotate( $N * -1 )[ $_ ] for ^@alphabet.elems;
+
+ say "Encoding $S";
+ print %cipher{ $_ }:exists ?? %cipher{ $_ } !! $_ for $S.comb;
+ say "\ndone";
+}