Software >> Development >> Languages >> Perl >>  How to convert a binary value to decimal

sub bintodec { unpack("N", pack("B32", substr("0" x 32 . shift, -32))); } $dec = bintodec("10001111"); print $dec;