aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-269/wlmb/blog.txt1
-rwxr-xr-xchallenge-269/wlmb/perl/ch-1.pl12
-rwxr-xr-xchallenge-269/wlmb/perl/ch-2.pl18
3 files changed, 31 insertions, 0 deletions
diff --git a/challenge-269/wlmb/blog.txt b/challenge-269/wlmb/blog.txt
new file mode 100644
index 0000000000..dcaf7bd21d
--- /dev/null
+++ b/challenge-269/wlmb/blog.txt
@@ -0,0 +1 @@
+https://wlmb.github.io/2024/05/13/PWC269/
diff --git a/challenge-269/wlmb/perl/ch-1.pl b/challenge-269/wlmb/perl/ch-1.pl
new file mode 100755
index 0000000000..25017d7253
--- /dev/null
+++ b/challenge-269/wlmb/perl/ch-1.pl
@@ -0,0 +1,12 @@
+#!/usr/bin/env perl
+# Perl weekly challenge 269
+# Task 1: Bitwise OR
+#
+# See https://wlmb.github.io/2024/05/13/PWC269/#task-1-bitwise-or
+use v5.36;
+die <<~"FIN" unless @ARGV;
+ Usage: $0 N1 N2...
+ to find if there are two or more numbers Ni whose bitwise
+ or has the zeroth bit turned off.
+ FIN
+say "@ARGV -> ", (my @x=grep {($_&1)==0} @ARGV)>=2?"True":"False";
diff --git a/challenge-269/wlmb/perl/ch-2.pl b/challenge-269/wlmb/perl/ch-2.pl
new file mode 100755
index 0000000000..124e96c179
--- /dev/null
+++ b/challenge-269/wlmb/perl/ch-2.pl
@@ -0,0 +1,18 @@
+#!/usr/bin/env perl
+# Perl weekly challenge 269
+# Task 2: Distribute Elements
+#
+# See https://wlmb.github.io/2024/05/13/PWC269/#task-2-distribute-elements
+use v5.36;
+die <<~"FIN" unless @ARGV>=2;
+ Usage: $0 N1 N2...
+ to redistribute the numbers N1 N2...
+ FIN
+my @in=@ARGV;
+my @y=(shift);
+my @z=(shift);
+for(@ARGV){
+ my $which=$y[-1]>$z[-1]?\@y:\@z;
+ push @$which,$_;
+}
+say "@in->@y @z";