diff options
| -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); +} |
