blob: 55a1e37928aeedb6f06fed2e01fe36f5b22fb8b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
# Task 2 of the Weekly Challenge 330
# https://theweeklychallenge.org/blog/perl-weekly-challenge-330/#TASK2
say title-capital('PERL IS gREAT'); # Perl is Great
say title-capital('THE weekly challenge'); # The Weekly Challenge
say title-capital('YoU ARE A stAR'); # You Are a Star
sub title-capital($str is copy) {
$str ~~ s:g/(\w+)/{$0.chars < 3 ?? $0.lc !! $0.tclc}/;
return $str;
}
|