diff options
| -rwxr-xr-x | challenge-045/e-choroba/perl/ch-1.pl | 17 | ||||
| -rwxr-xr-x | challenge-045/e-choroba/perl/ch-2a.pl | 8 | ||||
| -rw-r--r-- | challenge-045/e-choroba/perl/ch-2b.pl | 1 |
3 files changed, 26 insertions, 0 deletions
diff --git a/challenge-045/e-choroba/perl/ch-1.pl b/challenge-045/e-choroba/perl/ch-1.pl new file mode 100755 index 0000000000..9a6b758b09 --- /dev/null +++ b/challenge-045/e-choroba/perl/ch-1.pl @@ -0,0 +1,17 @@ +#!/usr/bin/perl +use warnings; +use strict; + +sub square_secret_code { + my ($message) = @_; + my @code = ("") x 8; + for my $group (lc($message) =~ s/\s//gr =~ m/(.{1,8})/g) { + $code[$_] .= (split //, $group)[$_] // "" for 0 .. 7; + } + return join ' ', @code +} + +use Test::More tests => 1; +is square_secret_code('The quick brown fox jumps over the lazy dog'), + 'tbjrd hruto eomhg qwpe unsl ifoa covz kxey', + 'encode'; diff --git a/challenge-045/e-choroba/perl/ch-2a.pl b/challenge-045/e-choroba/perl/ch-2a.pl new file mode 100755 index 0000000000..a98ab5bf84 --- /dev/null +++ b/challenge-045/e-choroba/perl/ch-2a.pl @@ -0,0 +1,8 @@ +#!/usr/bin/perl +use warnings; +use strict; + +seek *DATA, 0 , 0; +print while <DATA>; +__DATA__ + diff --git a/challenge-045/e-choroba/perl/ch-2b.pl b/challenge-045/e-choroba/perl/ch-2b.pl new file mode 100644 index 0000000000..488703eba7 --- /dev/null +++ b/challenge-045/e-choroba/perl/ch-2b.pl @@ -0,0 +1 @@ +$_=q!print'$_=q*'.$_.'*;';s/\52/\41/g;print!;print'$_=q!'.$_.'!;';s/\52/\41/g;print
\ No newline at end of file |
