diff options
| -rw-r--r-- | challenge-264/bob-lied/README | 6 | ||||
| -rw-r--r-- | challenge-264/bob-lied/perl/ch-1.pl | 48 |
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; +} |
