aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-264/deadmarshal/blog.txt1
-rw-r--r--challenge-264/deadmarshal/perl/ch-1.pl17
-rw-r--r--challenge-264/deadmarshal/perl/ch-2.pl15
3 files changed, 33 insertions, 0 deletions
diff --git a/challenge-264/deadmarshal/blog.txt b/challenge-264/deadmarshal/blog.txt
new file mode 100644
index 0000000000..41856a261f
--- /dev/null
+++ b/challenge-264/deadmarshal/blog.txt
@@ -0,0 +1 @@
+https://deadmarshal.blogspot.com/2024/04/twc264.html
diff --git a/challenge-264/deadmarshal/perl/ch-1.pl b/challenge-264/deadmarshal/perl/ch-1.pl
new file mode 100644
index 0000000000..bba50d75ef
--- /dev/null
+++ b/challenge-264/deadmarshal/perl/ch-1.pl
@@ -0,0 +1,17 @@
+#!/usr/local/bin/env perl
+use strict;
+use warnings;
+use Set::Scalar;
+use List::Util qw(maxstr);
+
+sub greatest_english_letter{
+ my $s1 = Set::Scalar->new;
+ my $s2 = Set::Scalar->new;
+ map{$_ le 'Z' ? $s1->insert($_) : $s2->insert(uc $_)} split '',$_[0];
+ maxstr($s1->intersection($s2)->members) // ''
+}
+
+printf "%s\n", greatest_english_letter('PeRlwEeKLy');
+printf "%s\n", greatest_english_letter('ChaLlenge');
+printf "%s\n", greatest_english_letter('The');
+
diff --git a/challenge-264/deadmarshal/perl/ch-2.pl b/challenge-264/deadmarshal/perl/ch-2.pl
new file mode 100644
index 0000000000..badf2c59dc
--- /dev/null
+++ b/challenge-264/deadmarshal/perl/ch-2.pl
@@ -0,0 +1,15 @@
+#!/usr/local/bin/env perl
+use strict;
+use warnings;
+use Data::Show;
+
+sub target_array{
+ my @ret;
+ splice @ret,$_[1]->[$_],0,$_[0]->[$_] foreach(0..$#{$_[1]});
+ @ret
+}
+
+print show target_array([0,1,2,3,4],[0,1,2,2,1]);
+print show target_array([1,2,3,4,0],[0,1,2,3,0]);
+print show target_array([1],[0]);
+