From 8ea7856804c9fdf27fd8e4a0ab576cf5255df9a1 Mon Sep 17 00:00:00 2001 From: Kang-min Liu Date: Tue, 19 Jan 2021 22:55:53 +0900 Subject: a solution to pwc 096.1 in perl --- challenge-096/gugod/perl/ch-1.pl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 challenge-096/gugod/perl/ch-1.pl 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); +} -- cgit