aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2025-07-18 22:26:49 +0100
committerGitHub <noreply@github.com>2025-07-18 22:26:49 +0100
commit40f22f27abdf607141973eb55d89809006431e70 (patch)
tree53e47864f91747f0940da19503486c3dca563a03
parentc426fab2721595210e8e2ad3cef39a501b938e30 (diff)
parent75bcc9af80058b7fc8841f046ba71b58f039b34a (diff)
downloadperlweeklychallenge-club-40f22f27abdf607141973eb55d89809006431e70.tar.gz
perlweeklychallenge-club-40f22f27abdf607141973eb55d89809006431e70.tar.bz2
perlweeklychallenge-club-40f22f27abdf607141973eb55d89809006431e70.zip
Merge pull request #12361 from akarelas/pr-akarelas
solution to challenge 330
-rwxr-xr-xchallenge-330/alexander-karelas/perl/ch-2.pl20
1 files changed, 20 insertions, 0 deletions
diff --git a/challenge-330/alexander-karelas/perl/ch-2.pl b/challenge-330/alexander-karelas/perl/ch-2.pl
new file mode 100755
index 0000000000..a6df47e7b0
--- /dev/null
+++ b/challenge-330/alexander-karelas/perl/ch-2.pl
@@ -0,0 +1,20 @@
+#!/usr/bin/env perl
+
+use v5.40;
+
+use Test2::V0;
+
+sub title_capital ($string) {
+ my @words = split / /, $string;
+ foreach (@words) {
+ $_ = lc;
+ $_ = ucfirst if length > 2;
+ }
+ return join ' ', @words;
+}
+
+is title_capital('PERL IS gREAT'), 'Perl is Great', 'Example 1';
+is title_capital('THE weekly challenge'), 'The Weekly Challenge', 'Example 2';
+is title_capital('YoU ARE A stAR'), 'You Are a Star', 'Example 3';
+
+done_testing;