aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Lied <boblied+github@gmail.com>2024-04-08 07:32:18 -0500
committerBob Lied <boblied+github@gmail.com>2024-04-08 07:32:18 -0500
commit8c4dde87b38217543f8d88d9d9f7c33f82eb4e95 (patch)
tree311cc0b4a5697d7e2d4f734286a5d9859198daae
parentf14e99c374e42f272a7e43324e5ac195996c9a54 (diff)
downloadperlweeklychallenge-club-8c4dde87b38217543f8d88d9d9f7c33f82eb4e95.tar.gz
perlweeklychallenge-club-8c4dde87b38217543f8d88d9d9f7c33f82eb4e95.tar.bz2
perlweeklychallenge-club-8c4dde87b38217543f8d88d9d9f7c33f82eb4e95.zip
Week 264 task 1 done
-rw-r--r--challenge-264/bob-lied/README6
-rw-r--r--challenge-264/bob-lied/perl/ch-1.pl48
2 files changed, 51 insertions, 3 deletions
diff --git a/challenge-264/bob-lied/README b/challenge-264/bob-lied/README
index 68da599a9d..3267f8159b 100644
--- a/challenge-264/bob-lied/README
+++ b/challenge-264/bob-lied/README
@@ -1,4 +1,4 @@
-Solutions to weekly challenge 263 by Bob Lied
+Solutions to weekly challenge 264 by Bob Lied
-https://perlweeklychallenge.org/blog/perl-weekly-challenge-263/
-https://github.com/boblied/perlweeklychallenge-club/tree/master/challenge-263/bob-lied
+https://perlweeklychallenge.org/blog/perl-weekly-challenge-264/
+https://github.com/boblied/perlweeklychallenge-club/tree/master/challenge-264/bob-lied
diff --git a/challenge-264/bob-lied/perl/ch-1.pl b/challenge-264/bob-lied/perl/ch-1.pl
new file mode 100644
index 0000000000..22d4f95f71
--- /dev/null
+++ b/challenge-264/bob-lied/perl/ch-1.pl
@@ -0,0 +1,48 @@
+#!/usr/bin/env perl
+# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu:
+#=============================================================================
+# Copyright (c) 2024, Bob Lied
+#=============================================================================
+#
+# ch-1.pl Perl Weekly Challenge 264 Task 1 Greatest English Letter
+#=============================================================================
+# You are given a string, $str, made up of only alphabetic characters
+# [a..zA..Z]. Write a script to return the greatest english letter in
+# the given string. A letter is greatest if it occurs as lower and upper
+# case. Also letter ‘b’ is greater than ‘a’ if ‘b’ appears after ‘a’ in
+# the English alphabet.
+# Example 1 Input: $str = 'PeRlwEeKLy'
+# Output: L
+# There are two letters E and L that appears as lower and upper.
+# The letter L appears after E, so the L is the greatest english letter.
+# Example 2 Input: $str = 'ChaLlenge'
+# Output: L
+# Example 3 Input: $str = 'The'
+# Output: ''
+#=============================================================================
+
+use v5.38;
+
+use builtin qw/true false/; no warnings "experimental::builtin";
+
+use Getopt::Long;
+my $Verbose = 0;
+my $DoTest = 0;
+
+GetOptions("test" => \$DoTest, "verbose" => \$Verbose);
+exit(!runTest()) if $DoTest;
+
+sub gle($str)
+{
+}
+
+sub runTest
+{
+ use Test2::V0;
+
+ is( gle("PeRlwEeKLy"), 'L', "Example 1");
+ is( gle("ChaLlenge" ), 'L', "Example 2");
+ is( gle("The" ), '', "Example 3");
+
+ done_testing;
+}