Skip to content

Commit

Permalink
improved solution for challenge 059-2
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-37 committed Jun 8, 2020
1 parent cc7cd44 commit b5b7ec8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions challenge-059/jo-37/perl/ch-2.pl
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

use strict;
use warnings;
use List::Util qw(reduce);

my @bits = map {pack 'Q', $_} @ARGV;
my $sum;
while (defined (my $x = shift)) {
my $bits = pack 'Q', $x;
$sum += unpack '%64b*', $bits ^ $_ foreach map {pack 'Q', $_} @ARGV;
while (defined (my $bits = shift @bits)) {
$sum += unpack '%64b*', $bits ^ $_ foreach @bits;
}
print $sum, "\n";

0 comments on commit b5b7ec8

Please sign in to comment.