aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2023-03-08 19:41:37 +0000
committerGitHub <noreply@github.com>2023-03-08 19:41:37 +0000
commit67ace03ee5af997e6bdb375ace179e308fbb2bfd (patch)
treea371eebe5cfcfca45e9183de4c9b1acefc2d9cfd
parentca0246441103b7d9adbc017a33b1f16cf31eceb5 (diff)
parentb99fe695d5645957b03f50697ecb5b2affe193d3 (diff)
downloadperlweeklychallenge-club-67ace03ee5af997e6bdb375ace179e308fbb2bfd.tar.gz
perlweeklychallenge-club-67ace03ee5af997e6bdb375ace179e308fbb2bfd.tar.bz2
perlweeklychallenge-club-67ace03ee5af997e6bdb375ace179e308fbb2bfd.zip
Merge pull request #7680 from wlmb/challenges
Solve PWC207
-rw-r--r--challenge-207/wlmb/blog.txt2
-rwxr-xr-xchallenge-207/wlmb/perl/ch-1.pl12
-rwxr-xr-xchallenge-207/wlmb/perl/ch-2.pl12
3 files changed, 26 insertions, 0 deletions
diff --git a/challenge-207/wlmb/blog.txt b/challenge-207/wlmb/blog.txt
new file mode 100644
index 0000000000..a505d8681e
--- /dev/null
+++ b/challenge-207/wlmb/blog.txt
@@ -0,0 +1,2 @@
+https://wlmb.github.io/2023/03/06/PWC207/
+
diff --git a/challenge-207/wlmb/perl/ch-1.pl b/challenge-207/wlmb/perl/ch-1.pl
new file mode 100755
index 0000000000..c21d841bea
--- /dev/null
+++ b/challenge-207/wlmb/perl/ch-1.pl
@@ -0,0 +1,12 @@
+#!/usr/bin/env perl
+# Perl weekly challenge 207
+# Task 1: Keyboard Word
+#
+# See https://wlmb.github.io/2023/03/06/PWC207/#task-1-keyboard-word
+use v5.36;
+die <<~"FIN" unless @ARGV;
+ Usage: $0 W1 [W2...]
+ to find which of the words W1 W2... may be written using a single keyboard row.
+ FIN
+say join " ", @ARGV, "->",
+ grep {/^([qwertyuiop]+|[asdfghjkl]+|[zxcvbnm]+)$/i} @ARGV;
diff --git a/challenge-207/wlmb/perl/ch-2.pl b/challenge-207/wlmb/perl/ch-2.pl
new file mode 100755
index 0000000000..d007b11f81
--- /dev/null
+++ b/challenge-207/wlmb/perl/ch-2.pl
@@ -0,0 +1,12 @@
+#!/usr/bin/env perl
+# Perl weekly challenge 207
+# Task 2: H-Index
+#
+# See https://wlmb.github.io/2023/03/06/PWC207/#task-2-h-index
+use v5.36;
+my $h=0;
+for(sort{$b<=>$a}@ARGV){
+ last if $_<=$h;
+ ++$h
+}
+say join " ", @ARGV, "->", $h;