aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-280/wlmb/blog.txt1
-rwxr-xr-xchallenge-280/wlmb/perl/ch-1.pl18
-rwxr-xr-xchallenge-280/wlmb/perl/ch-2.pl16
3 files changed, 35 insertions, 0 deletions
diff --git a/challenge-280/wlmb/blog.txt b/challenge-280/wlmb/blog.txt
new file mode 100644
index 0000000000..b63b336747
--- /dev/null
+++ b/challenge-280/wlmb/blog.txt
@@ -0,0 +1 @@
+https://wlmb.github.io/2024/07/29/PWC280/
diff --git a/challenge-280/wlmb/perl/ch-1.pl b/challenge-280/wlmb/perl/ch-1.pl
new file mode 100755
index 0000000000..c63ce01f0c
--- /dev/null
+++ b/challenge-280/wlmb/perl/ch-1.pl
@@ -0,0 +1,18 @@
+#!/usr/bin/env perl
+# Perl weekly challenge 280
+# Task 1: Twice Appearance
+#
+# See https://wlmb.github.io/2024/07/29/PWC280/#task-1-twice-appearance
+use v5.36;
+die <<~"FIN" unless @ARGV;
+ Usage: $0 S1 S2...
+ to print the first duplicated letter in the strings S1 S2...
+ FIN
+for(@ARGV){
+ my %count;
+ warn("Expected lower case letters only: $_"), next unless /^[a-z]*$/;
+ print "$_ -> ";
+ for(split ""){
+ say($_),last if ++$count{$_}==2;
+ }
+}
diff --git a/challenge-280/wlmb/perl/ch-2.pl b/challenge-280/wlmb/perl/ch-2.pl
new file mode 100755
index 0000000000..90d01ef22f
--- /dev/null
+++ b/challenge-280/wlmb/perl/ch-2.pl
@@ -0,0 +1,16 @@
+#!/usr/bin/env perl
+# Perl weekly challenge 280
+# Task 2: Count Asterisks
+#
+# See https://wlmb.github.io/2024/07/29/PWC280/#task-2-count-asterisks
+use v5.36;
+die <<~"FIN" unless @ARGV;
+ Usage: $0 S1 S2...
+ to count the asterisks in the strings S1 S2... that are not within
+ pairs of vertical bars.
+ FIN
+for(@ARGV){
+ print "$_ -> ";
+ s/\|.*?\|//g;
+ say tr/*//
+}