aboutsummaryrefslogtreecommitdiff
path: root/challenge-030
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-030')
-rwxr-xr-xchallenge-030/daniel-mita/perl5/ch-2.pl15
-rwxr-xr-xchallenge-030/daniel-mita/perl6/ch-2.p64
2 files changed, 17 insertions, 2 deletions
diff --git a/challenge-030/daniel-mita/perl5/ch-2.pl b/challenge-030/daniel-mita/perl5/ch-2.pl
new file mode 100755
index 0000000000..87e6d2e717
--- /dev/null
+++ b/challenge-030/daniel-mita/perl5/ch-2.pl
@@ -0,0 +1,15 @@
+#!/usr/bin/env perl
+use 5.012;
+use warnings;
+
+use List::Util qw(sum);
+
+for my $i ( 1..10 ) {
+ for my $j ( 1..10 ) {
+ for my $k ( 1..10 ) {
+ my @group = ( $i, $j, $k );
+ say join '|', map { sprintf '%2u', $_ } @group
+ if sum(@group) == 12;
+ }
+ }
+}
diff --git a/challenge-030/daniel-mita/perl6/ch-2.p6 b/challenge-030/daniel-mita/perl6/ch-2.p6
index 84de4a0008..085e8af697 100755
--- a/challenge-030/daniel-mita/perl6/ch-2.p6
+++ b/challenge-030/daniel-mita/perl6/ch-2.p6
@@ -1,6 +1,6 @@
#!/usr/bin/env perl6
use v6;
-for [X] (1..12) xx 3 {
- .fmt('%2u', '|').say when .sum == 12 && .any %% 2;
+for [X] ( 1..10 ) xx 3 {
+ .fmt('%2u', '|').say when .sum == 12;
}