diff options
Diffstat (limited to 'challenge-059/jo-37/perl/ch-2.pl')
| -rwxr-xr-x | challenge-059/jo-37/perl/ch-2.pl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/challenge-059/jo-37/perl/ch-2.pl b/challenge-059/jo-37/perl/ch-2.pl new file mode 100755 index 0000000000..6bd296e10a --- /dev/null +++ b/challenge-059/jo-37/perl/ch-2.pl @@ -0,0 +1,15 @@ +#!/usr/bin/perl + +# expects input in @ARGV +# prints result to STDOUT +# numbers must be in the range 0 .. 2**64 - 1 + +use strict; +use warnings; + +my $sum; +while (defined (my $x = shift)) { + my $bits = pack 'Q', $x; + $sum += unpack '%64b*', $bits ^ $_ foreach map {pack 'Q', $_} @ARGV; +} +print $sum, "\n"; |
