diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2020-05-04 13:04:28 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-04 13:04:28 +0100 |
| commit | 462006ea125c21c7a38bb57538a7a6199e3c6ec0 (patch) | |
| tree | 07ac102a2c490127811740cfeb68baa147b3b1fa /challenge-059 | |
| parent | c514bff6d2807e124729403c18b4190d251b0e2d (diff) | |
| parent | 733e51221afa9aef20454f07b6639b1f41e24513 (diff) | |
| download | perlweeklychallenge-club-462006ea125c21c7a38bb57538a7a6199e3c6ec0.tar.gz perlweeklychallenge-club-462006ea125c21c7a38bb57538a7a6199e3c6ec0.tar.bz2 perlweeklychallenge-club-462006ea125c21c7a38bb57538a7a6199e3c6ec0.zip | |
Merge pull request #1669 from Doomtrain14/master
Merge branch 'master' of https://github.com/manwar/perlweeklychallenge-club
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 |
