diff options
| author | Paulo Custodio <pauloscustodio@gmail.com> | 2022-04-06 16:37:17 +0100 |
|---|---|---|
| committer | Paulo Custodio <pauloscustodio@gmail.com> | 2022-04-06 16:37:17 +0100 |
| commit | f93043f673515bc8961338fb4c65ebd3fcc98b2e (patch) | |
| tree | 2bd9927c97244d15e5a698139914e50091b11ae8 | |
| parent | 9b682c1fd7e5aac0580b5e22838696c4f7f4b33d (diff) | |
| download | perlweeklychallenge-club-f93043f673515bc8961338fb4c65ebd3fcc98b2e.tar.gz perlweeklychallenge-club-f93043f673515bc8961338fb4c65ebd3fcc98b2e.tar.bz2 perlweeklychallenge-club-f93043f673515bc8961338fb4c65ebd3fcc98b2e.zip | |
Whitespace
| -rw-r--r-- | challenge-040/paulo-custodio/perl/ch-1.pl | 24 | ||||
| -rw-r--r-- | challenge-040/paulo-custodio/perl/ch-2.pl | 20 | ||||
| -rw-r--r-- | challenge-040/paulo-custodio/t/test-1.yaml | 2 | ||||
| -rw-r--r-- | challenge-040/paulo-custodio/t/test-2.yaml | 2 |
4 files changed, 24 insertions, 24 deletions
diff --git a/challenge-040/paulo-custodio/perl/ch-1.pl b/challenge-040/paulo-custodio/perl/ch-1.pl index a2a0864467..897def825f 100644 --- a/challenge-040/paulo-custodio/perl/ch-1.pl +++ b/challenge-040/paulo-custodio/perl/ch-1.pl @@ -6,14 +6,14 @@ # Show multiple arrays content # You are given two or more arrays. Write a script to display values of each # list at a given index. -# +# # For example: -# +# # Array 1: [ I L O V E Y O U ] # Array 2: [ 2 4 0 3 2 0 1 9 ] # Array 3: [ ! ? @ $ % ^ & * ] # We expect the following output: -# +# # I 2 ! # L 4 ? # O 0 @ @@ -26,15 +26,15 @@ use Modern::Perl; show_multiple([qw( I L O V E Y O U )], - [qw( 2 4 0 3 2 0 1 9 )], - [qw( ! ? @ $ % ^ & * )]); + [qw( 2 4 0 3 2 0 1 9 )], + [qw( ! ? @ $ % ^ & * )]); sub show_multiple { - my(@data) = @_; - for my $i (0 .. $#{$data[0]}) { - for (@data) { - print $_->[$i]," "; - } - print "\n"; - } + my(@data) = @_; + for my $i (0 .. $#{$data[0]}) { + for (@data) { + print $_->[$i]," "; + } + print "\n"; + } } diff --git a/challenge-040/paulo-custodio/perl/ch-2.pl b/challenge-040/paulo-custodio/perl/ch-2.pl index 2194cfebb9..eff9d7cd74 100644 --- a/challenge-040/paulo-custodio/perl/ch-2.pl +++ b/challenge-040/paulo-custodio/perl/ch-2.pl @@ -6,15 +6,15 @@ # Sort SubList # You are given a list of numbers and set of indices belong to the list. # Write a script to sort the values belongs to the indices. -# +# # For example, -# +# # List: [ 10, 4, 1, 8, 12, 3 ] # Indices: 0,2,5 # We would sort the values at indices 0, 2 and 5 i.e. 10, 1 and 3. -# +# # Final List would look like below: -# +# # List: [ 1, 4, 3, 8, 12, 10 ] use Modern::Perl; @@ -26,10 +26,10 @@ my @indices = (0,2,5); say "[", join(", ", @list), "]"; sub sort_sublist { - my($list, $indices) = @_; - my @list = @$list; - my @indices = @$indices; - my @values = sort {$a<=>$b} @list[@indices]; - @list[@indices] = @values; - return @list; + my($list, $indices) = @_; + my @list = @$list; + my @indices = @$indices; + my @values = sort {$a<=>$b} @list[@indices]; + @list[@indices] = @values; + return @list; } diff --git a/challenge-040/paulo-custodio/t/test-1.yaml b/challenge-040/paulo-custodio/t/test-1.yaml index da15f04e81..f64e7676f4 100644 --- a/challenge-040/paulo-custodio/t/test-1.yaml +++ b/challenge-040/paulo-custodio/t/test-1.yaml @@ -1,6 +1,6 @@ - setup: cleanup: - args: + args: input: output: | |I 2 ! diff --git a/challenge-040/paulo-custodio/t/test-2.yaml b/challenge-040/paulo-custodio/t/test-2.yaml index c5feb3b973..78fcc55415 100644 --- a/challenge-040/paulo-custodio/t/test-2.yaml +++ b/challenge-040/paulo-custodio/t/test-2.yaml @@ -1,5 +1,5 @@ - setup: cleanup: - args: + args: input: output: [1, 4, 3, 8, 12, 10] |
