aboutsummaryrefslogtreecommitdiff
path: root/challenge-059
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-059')
-rwxr-xr-xchallenge-059/jo-37/perl/ch-2.pl7
1 files changed, 4 insertions, 3 deletions
diff --git a/challenge-059/jo-37/perl/ch-2.pl b/challenge-059/jo-37/perl/ch-2.pl
index 6bd296e10a..85ead44c0d 100755
--- a/challenge-059/jo-37/perl/ch-2.pl
+++ b/challenge-059/jo-37/perl/ch-2.pl
@@ -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";