From ccd62bfcbdbcce89afc8f7351b00abbb2b9d0321 Mon Sep 17 00:00:00 2001 From: Luis Mochan Date: Mon, 23 Nov 2020 08:49:44 -0600 Subject: Add output as comment. --- challenge-088/wlmb/perl/ch-1.pl | 4 +++- challenge-088/wlmb/perl/ch-2.pl | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/challenge-088/wlmb/perl/ch-1.pl b/challenge-088/wlmb/perl/ch-1.pl index 1abce9b7fc..fad2edcfc8 100644 --- a/challenge-088/wlmb/perl/ch-1.pl +++ b/challenge-088/wlmb/perl/ch-1.pl @@ -7,7 +7,9 @@ use feature qw(say); say join " ", "Example 1:", array_of_products(5,2,1,4,3); say join " ", "Example 2:", array_of_products(2,1,4,3); - +# Output: +# Example 1: 24 60 120 30 40 +# Example 2: 12 24 6 8 sub array_of_products { use PDL; #use the perl data language use PDL::NiceSlice; diff --git a/challenge-088/wlmb/perl/ch-2.pl b/challenge-088/wlmb/perl/ch-2.pl index 18e95cead5..4cf538472b 100644 --- a/challenge-088/wlmb/perl/ch-2.pl +++ b/challenge-088/wlmb/perl/ch-2.pl @@ -7,12 +7,13 @@ use feature qw(say); say join " ", "Example 1:", spiral_matrix([1,2,3],[4,5,6],[7,8,9]); say join " ", "Example 2:", spiral_matrix([1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]); - +# output: +# Example 1: 1 2 3 6 9 8 7 4 5 +# Example 2: 1 2 3 4 8 12 16 15 14 13 9 5 6 7 11 10 sub spiral_matrix { use PDL; #use the perl data language use PDL::NiceSlice; my $input =pdl(@_); #input piddle (PDL 2D array) - say $input; my @output; return if $input->dim(1)==0; # 0 rows no elements while($input->dim(0) > 0){ #until no more columns -- cgit