diff options
Diffstat (limited to 'challenge-059')
| -rw-r--r-- | challenge-059/yet-ebreo/perl/ch-2.pl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-059/yet-ebreo/perl/ch-2.pl b/challenge-059/yet-ebreo/perl/ch-2.pl new file mode 100644 index 0000000000..848b6ac28c --- /dev/null +++ b/challenge-059/yet-ebreo/perl/ch-2.pl @@ -0,0 +1,18 @@ +#!/usr/bin/perl +use strict; +use warnings; +use feature 'say'; +use Algorithm::Combinatorics qw(combinations); + +sub f { + (sprintf "%b", (pop) ^ pop)=~y/1// +} + +my @arr = (2, 3, 4); +#Not recommended when expecting large sums. +say 0+map 1..f(@$_), combinations(\@arr, 2); + +=begin +perl .\ch-2.pl +6 +=cut
\ No newline at end of file |
