diff options
| author | Kang-min Liu <gugod@gugod.org> | 2021-01-19 22:55:53 +0900 |
|---|---|---|
| committer | Kang-min Liu <gugod@gugod.org> | 2021-01-19 23:00:58 +0900 |
| commit | 8ea7856804c9fdf27fd8e4a0ab576cf5255df9a1 (patch) | |
| tree | cb63b1c38754334eca8c3c120f313f1daf757f5c | |
| parent | 827f442db4ed03985c62c1f754eb50f893032316 (diff) | |
| download | perlweeklychallenge-club-8ea7856804c9fdf27fd8e4a0ab576cf5255df9a1.tar.gz perlweeklychallenge-club-8ea7856804c9fdf27fd8e4a0ab576cf5255df9a1.tar.bz2 perlweeklychallenge-club-8ea7856804c9fdf27fd8e4a0ab576cf5255df9a1.zip | |
a solution to pwc 096.1 in perl
| -rw-r--r-- | challenge-096/gugod/perl/ch-1.pl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-096/gugod/perl/ch-1.pl b/challenge-096/gugod/perl/ch-1.pl new file mode 100644 index 0000000000..7e7dfd792e --- /dev/null +++ b/challenge-096/gugod/perl/ch-1.pl @@ -0,0 +1,18 @@ +use v5.30; +use feature 'signatures'; + +sub reverse_words ($S) { + return join " ", reverse split " ", $S; +} + +## main +my @examples = ( + "The Weekly Challenge", + " Perl and Raku are part of the same family ", + "join reverse split \$S", +); + +for my $S (@examples) { + say "Input: $S"; + say "Output: " . reverse_words($S); +} |
