aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
+}