aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Shitov <mail@andreyshitov.com>2025-07-14 09:11:47 +0200
committerAndrew Shitov <mail@andreyshitov.com>2025-07-14 09:11:47 +0200
commit19d33ee7644808e1e90c548959ff5ea5955caf78 (patch)
tree3d29d5f477cb8f11c5f6b255a09b8663c5fc0ae2
parent6345c73edaafe1c1252e99cf8991c8fc27890445 (diff)
downloadperlweeklychallenge-club-19d33ee7644808e1e90c548959ff5ea5955caf78.tar.gz
perlweeklychallenge-club-19d33ee7644808e1e90c548959ff5ea5955caf78.tar.bz2
perlweeklychallenge-club-19d33ee7644808e1e90c548959ff5ea5955caf78.zip
Raku solutions to Week 330 by @ash
-rw-r--r--challenge-330/ash/raku/ch-1.raku11
-rw-r--r--challenge-330/ash/raku/ch-2.raku12
2 files changed, 23 insertions, 0 deletions
diff --git a/challenge-330/ash/raku/ch-1.raku b/challenge-330/ash/raku/ch-1.raku
new file mode 100644
index 0000000000..9c75deffc4
--- /dev/null
+++ b/challenge-330/ash/raku/ch-1.raku
@@ -0,0 +1,11 @@
+# Task 1 of the Weekly Challenge 330
+# https://theweeklychallenge.org/blog/perl-weekly-challenge-330/#TASK1
+
+say clear-digits('cab12'); # c
+say clear-digits('xy99'); # ''
+say clear-digits('pa1erl'); # perl
+
+sub clear-digits($str) {
+ my $cln = S/<:L>\d// with $str;
+ return $cln eq $str ?? $cln !! clear-digits($cln);
+}
diff --git a/challenge-330/ash/raku/ch-2.raku b/challenge-330/ash/raku/ch-2.raku
new file mode 100644
index 0000000000..55a1e37928
--- /dev/null
+++ b/challenge-330/ash/raku/ch-2.raku
@@ -0,0 +1,12 @@
+# Task 2 of the Weekly Challenge 330
+# https://theweeklychallenge.org/blog/perl-weekly-challenge-330/#TASK2
+
+say title-capital('PERL IS gREAT'); # Perl is Great
+say title-capital('THE weekly challenge'); # The Weekly Challenge
+say title-capital('YoU ARE A stAR'); # You Are a Star
+
+sub title-capital($str is copy) {
+ $str ~~ s:g/(\w+)/{$0.chars < 3 ?? $0.lc !! $0.tclc}/;
+
+ return $str;
+}