Thursday, April 21, 2016

Perl One Liner Quickly Spit Out Decimal from Binary

perl -e 'print unpack("N", pack("B32", substr( "0"x32 . "YOUR_NUM_HERE", -32 ))),"\n";'

Arul's code wasn't as helpful as Stack Overflow..

Making the long YOUR NUMs readable :

perl -e 'print unpack("N", pack("B32", substr( "0"x32 . "0110" . "1010" . "1100", -32 ))),"\n";'

No comments: