diff options
| -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; +} |
