Combine unpack and pack in one statement : unpack « System Functions « Perl






Combine unpack and pack in one statement

      

$decimal = 4;
$binary = unpack("B32", pack("N", $decimal));
print $binary;

   
    
    
    
    
    
  








Related examples in the same category

1.pack and unpack.
2.Pack to hex string and unpack
3.The Template pack and unpack Types and Values
4.Using pack and unpack to convert decimal number to binary number back and forth