diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2025-07-15 10:43:45 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-15 10:43:45 +0100 |
| commit | 76d54850758291f7e04ba5c015a45955161a817c (patch) | |
| tree | fbf8f295b25b1730f40d5aa1c8e0019736daa444 | |
| parent | 2041bdc4023d06e6d1537d8f73ab6a35218130d2 (diff) | |
| parent | 19d33ee7644808e1e90c548959ff5ea5955caf78 (diff) | |
| download | perlweeklychallenge-club-76d54850758291f7e04ba5c015a45955161a817c.tar.gz perlweeklychallenge-club-76d54850758291f7e04ba5c015a45955161a817c.tar.bz2 perlweeklychallenge-club-76d54850758291f7e04ba5c015a45955161a817c.zip | |
Merge pull request #12342 from ash/ash-330
Raku solutions to Week 330 by @ash
| -rw-r--r-- | challenge-330/ash/raku/ch-1.raku | 11 | ||||
| -rw-r--r-- | challenge-330/ash/raku/ch-2.raku | 12 |
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; +} |
