- or download this
perl -wMstrict -le 'print unpack("i",pack("B32","00000011"))'
3
- or download this
perl -wMstrict -le 'print unpack("B8",pack("i",3))'
00000011
- or download this
#!/usr/bin/perl
use strict;
...
my $binary2int = bin2dec( $int2bin , 8 , "c" );
print "Decimal from binary: ".$binary2int."\n";