note
athomason
Use <code>oct</code> to go from bitstrings to numbers and <code>sprintf</code> to go from a number to a bitstring. As for the math, the usual operators work once you've done the conversion.
<code>
#!/usr/bin/perl
use strict;
use warnings;
my $bitstring1 = shift @ARGV || '10010010111';
my $bitstring2 = shift @ARGV || '01101011010';
my $number1 = oct "0b$bitstring1";
my $number2 = oct "0b$bitstring2";
printf "%s + %s = %b\n", $bitstring1, $bitstring2, $number1 + $number2;
</code>
<p>
<b>Update</b>
<p>As [BrowserUK] mentioned, this will only get you as far as your platform's integer types allow. Fortunately, [cpan://Math::BigInt] also accepts the '0b' prefix for input and has the <code>as_bin</code> method for output, and has replacements for oodles of math operations.
295453
295453