aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2025-07-16 09:33:46 +0100
committerGitHub <noreply@github.com>2025-07-16 09:33:46 +0100
commit0b4045d268cb224b6b57dee2465104fcec6e9c33 (patch)
tree8592cce36fdab73e6e51aa5b93676805804c33ab
parent8be6aa1db8c4023ddbdf11db681e94b8c694db7b (diff)
parent5286bf621666c377bdfb7fdebce4bf9d1992a2a5 (diff)
downloadperlweeklychallenge-club-0b4045d268cb224b6b57dee2465104fcec6e9c33.tar.gz
perlweeklychallenge-club-0b4045d268cb224b6b57dee2465104fcec6e9c33.tar.bz2
perlweeklychallenge-club-0b4045d268cb224b6b57dee2465104fcec6e9c33.zip
Merge pull request #12358 from woznotwoz/woznotwoz-ch-330-solution
Woznotwoz ch 330 solution
-rw-r--r--challenge-330/woznotwoz/README1
-rw-r--r--challenge-330/woznotwoz/perl/ch-330.pl16
2 files changed, 17 insertions, 0 deletions
diff --git a/challenge-330/woznotwoz/README b/challenge-330/woznotwoz/README
new file mode 100644
index 0000000000..4304358aab
--- /dev/null
+++ b/challenge-330/woznotwoz/README
@@ -0,0 +1 @@
+Solution by Harry Wozniak
diff --git a/challenge-330/woznotwoz/perl/ch-330.pl b/challenge-330/woznotwoz/perl/ch-330.pl
new file mode 100644
index 0000000000..f6b65f32e5
--- /dev/null
+++ b/challenge-330/woznotwoz/perl/ch-330.pl
@@ -0,0 +1,16 @@
+#! perl
+use v5.40.0;
+use Test2::V0 -no_srand => 1;
+
+is remove_digits('cab12'), 'c', 'first example';
+is remove_digits('xy99'), '', 'second example';
+is remove_digits('99999xy'), 'xy', 'third example';
+done_testing;
+
+sub remove_digits ($str) {
+ $str = substr($str,1) while $str =~ /^\d/;
+ while ($str =~ /\d/) {
+ $str =~ s/.\d//;
+ }
+ $str;
+}