Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

22 lines (16 sloc) 0.378 kb
package DDG::Goodie::Xor;
use DDG::Goodie;
triggers any => 'xor', '';
zci is_cached => 1;
zci answer_type => "xor";
handle query_raw => sub {
my @nums = grep(!/(xor|⊕)/, split(/\s+(⊕|xor)\s+/i, $_));
my $num = 0;
foreach (@nums) {
$num ^= ord(chr($_)) if /^\d+$/;
return unless /^\d+$/;
}
return "$num" if $num;
return;
};
1;
Jump to Line
Something went wrong with that request. Please try again.