diff options
| -rw-r--r-- | challenge-340/wlmb/blog.txt | 1 | ||||
| -rwxr-xr-x | challenge-340/wlmb/perl/ch-1.pl | 15 | ||||
| -rwxr-xr-x | challenge-340/wlmb/perl/ch-2.pl | 13 |
3 files changed, 29 insertions, 0 deletions
diff --git a/challenge-340/wlmb/blog.txt b/challenge-340/wlmb/blog.txt new file mode 100644 index 0000000000..ad835ab5f2 --- /dev/null +++ b/challenge-340/wlmb/blog.txt @@ -0,0 +1 @@ +https://wlmb.github.io/2025/09/22/PWC340/ diff --git a/challenge-340/wlmb/perl/ch-1.pl b/challenge-340/wlmb/perl/ch-1.pl new file mode 100755 index 0000000000..9da0302551 --- /dev/null +++ b/challenge-340/wlmb/perl/ch-1.pl @@ -0,0 +1,15 @@ +#!/usr/bin/env perl +# Perl weekly challenge 340 +# Task 1: Duplicate Removals +# +# See https://wlmb.github.io/2025/09/22/PWC340/#task-1-duplicate-removals +use v5.36; +die <<~"FIN" unless @ARGV; + Usage: $0 S0 S1... + to remove adjacent duplicate characters from the strings S0 S1... + FIN +for(@ARGV){ + my $input=$_; + 1 while s/(.)\1//g; + say "$input -> $_" +} diff --git a/challenge-340/wlmb/perl/ch-2.pl b/challenge-340/wlmb/perl/ch-2.pl new file mode 100755 index 0000000000..5104134488 --- /dev/null +++ b/challenge-340/wlmb/perl/ch-2.pl @@ -0,0 +1,13 @@ +#!/usr/bin/env perl +# Perl weekly challenge 340 +# Task 2: Ascending Numbers +# +# See https://wlmb.github.io/2025/09/22/PWC340/#task-2-ascending-numbers +use v5.36; +use List::Util qw(uniq); +for(@ARGV){ + my @splitted= grep {length>0} split/[^0-9]+/; # split on non digits. May let some badly formed strings through + my @sorted = sort {$a<=>$b} uniq @splitted; # remove duplicates and numerically sort all numbers + my $result = "@sorted" eq "@splitted"?"True":"False"; # join and compare as strings + say "$_ -> ", $result +} |
